2005-03-03 18:09:08 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* afloader.c */
|
|
|
|
/* */
|
|
|
|
/* Auto-fitter glyph loading routines (body). */
|
|
|
|
/* */
|
2015-01-17 20:41:43 +01:00
|
|
|
/* Copyright 2003-2015 by */
|
2005-03-03 18:09:08 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2012-10-20 08:34:57 +02:00
|
|
|
#include "afglobal.h"
|
2004-03-27 09:43:17 +01:00
|
|
|
#include "afloader.h"
|
|
|
|
#include "afhints.h"
|
2005-03-23 17:45:24 +01:00
|
|
|
#include "aferrors.h"
|
2012-09-14 12:26:57 +02:00
|
|
|
#include "afmodule.h"
|
2013-08-02 14:50:23 +02:00
|
|
|
#include "afpic.h"
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2011-02-26 17:32:38 +01:00
|
|
|
/* Initialize glyph loader. */
|
|
|
|
|
2015-01-14 19:07:54 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2015-01-14 19:16:12 +01:00
|
|
|
af_loader_init( AF_Loader loader,
|
|
|
|
AF_GlyphHints hints )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
|
|
|
FT_ZERO( loader );
|
|
|
|
|
2015-01-14 19:16:12 +01:00
|
|
|
loader->hints = hints;
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-26 17:32:38 +01:00
|
|
|
/* Reset glyph loader and compute globals if necessary. */
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2015-01-14 16:01:19 +01:00
|
|
|
af_loader_reset( AF_Loader loader,
|
|
|
|
AF_Module module,
|
2005-03-02 12:24:23 +01:00
|
|
|
FT_Face face )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
2015-01-14 16:01:19 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
loader->face = face;
|
2005-03-02 12:24:23 +01:00
|
|
|
loader->globals = (AF_FaceGlobals)face->autohint.data;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
if ( loader->globals == NULL )
|
|
|
|
{
|
2012-09-18 15:23:41 +02:00
|
|
|
error = af_face_globals_new( face, &loader->globals, module );
|
2004-03-27 09:43:17 +01:00
|
|
|
if ( !error )
|
|
|
|
{
|
2005-03-02 12:24:23 +01:00
|
|
|
face->autohint.data =
|
|
|
|
(FT_Pointer)loader->globals;
|
|
|
|
face->autohint.finalizer =
|
|
|
|
(FT_Generic_Finalizer)af_face_globals_free;
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
}
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-26 17:32:38 +01:00
|
|
|
/* Finalize glyph loader. */
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2015-01-14 16:01:19 +01:00
|
|
|
af_loader_done( AF_Loader loader )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
|
|
|
loader->face = NULL;
|
|
|
|
loader->globals = NULL;
|
2015-01-14 19:16:12 +01:00
|
|
|
loader->hints = NULL;
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-14 18:55:39 +01:00
|
|
|
/* Do the main work of `af_loader_load_glyph'. Note that we never */
|
|
|
|
/* have to deal with composite glyphs as those get loaded into */
|
|
|
|
/* FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. */
|
|
|
|
/* In the rare cases where FT_LOAD_NO_RECURSE is set, it implies */
|
|
|
|
/* FT_LOAD_NO_SCALE and as such the auto-hinter is never called. */
|
2011-02-26 17:32:38 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
static FT_Error
|
|
|
|
af_loader_load_g( AF_Loader loader,
|
|
|
|
AF_Scaler scaler,
|
|
|
|
FT_UInt glyph_index,
|
2015-01-14 18:55:39 +01:00
|
|
|
FT_Int32 load_flags )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
2005-03-02 12:24:23 +01:00
|
|
|
FT_Error error;
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Face face = loader->face;
|
2013-12-18 12:59:35 +01:00
|
|
|
AF_StyleMetrics metrics = loader->metrics;
|
2015-01-14 19:16:12 +01:00
|
|
|
AF_GlyphHints hints = loader->hints;
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_GlyphSlot slot = face->glyph;
|
|
|
|
FT_Slot_Internal internal = slot->internal;
|
2015-01-14 19:07:54 +01:00
|
|
|
FT_GlyphLoader gloader = internal->loader;
|
[autofit] Return correct linear advance width values.
This was quite a subtle bug which accidentally showed up with glyph
`afii10023' of arial.ttf (version 2.76). This glyph is a composite;
the first component, `E', has an advance width of 1366 font units,
while the advance width of the composite itself (which looks like
uppercase `E' with dieresis) is 1367 font units. I think this is
actually a bug in the font itself, because there is no reason that
this glyph has not the same width as uppercase `E' without the
dieresis. Anyway, it helped identify this problem.
Using the TrueType hinter, the correct value (1367) of `afii10023'
was returned, but the autohinter mysteriously returned 1366.
Digging in the code showed that the autohinter recursively calls
FT_Load_Glyph to load the glyph, adding the FT_LOAD_NO_SCALE load
flag. However, the `linearHoriAdvance' field is still returned as a
scaled value. To avoid scaling twice, the old code in autofit reset
`linearHoriAdvance', using the `horiAdvance' field. This seemed to
work since FT_LOAD_NO_SCALE was in use, but it failed actually,
because `horiAdvance' is defined as the distance of the first
subglyph's phantom points, which in turn are initialized using the
advance width of the first subglyph. And as the given example
shows, these widths can differ.
* src/autofit/afloader.c (af_loader_load_g): Temporarily set
FT_LOAD_LINEAR_DESIGN while calling FT_Load_Glyph to get unscaled
values for the linear advance widths.
2012-03-11 15:20:32 +01:00
|
|
|
FT_Int32 flags;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
[autofit] Return correct linear advance width values.
This was quite a subtle bug which accidentally showed up with glyph
`afii10023' of arial.ttf (version 2.76). This glyph is a composite;
the first component, `E', has an advance width of 1366 font units,
while the advance width of the composite itself (which looks like
uppercase `E' with dieresis) is 1367 font units. I think this is
actually a bug in the font itself, because there is no reason that
this glyph has not the same width as uppercase `E' without the
dieresis. Anyway, it helped identify this problem.
Using the TrueType hinter, the correct value (1367) of `afii10023'
was returned, but the autohinter mysteriously returned 1366.
Digging in the code showed that the autohinter recursively calls
FT_Load_Glyph to load the glyph, adding the FT_LOAD_NO_SCALE load
flag. However, the `linearHoriAdvance' field is still returned as a
scaled value. To avoid scaling twice, the old code in autofit reset
`linearHoriAdvance', using the `horiAdvance' field. This seemed to
work since FT_LOAD_NO_SCALE was in use, but it failed actually,
because `horiAdvance' is defined as the distance of the first
subglyph's phantom points, which in turn are initialized using the
advance width of the first subglyph. And as the given example
shows, these widths can differ.
* src/autofit/afloader.c (af_loader_load_g): Temporarily set
FT_LOAD_LINEAR_DESIGN while calling FT_Load_Glyph to get unscaled
values for the linear advance widths.
2012-03-11 15:20:32 +01:00
|
|
|
flags = load_flags | FT_LOAD_LINEAR_DESIGN;
|
|
|
|
error = FT_Load_Glyph( face, glyph_index, flags );
|
2004-03-27 09:43:17 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
loader->transformed = internal->glyph_transformed;
|
|
|
|
if ( loader->transformed )
|
|
|
|
{
|
|
|
|
FT_Matrix inverse;
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->trans_matrix = internal->glyph_matrix;
|
|
|
|
loader->trans_delta = internal->glyph_delta;
|
|
|
|
|
|
|
|
inverse = loader->trans_matrix;
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
if ( !FT_Matrix_Invert( &inverse ) )
|
|
|
|
FT_Vector_Transform( &loader->trans_delta, &inverse );
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
switch ( slot->format )
|
|
|
|
{
|
2005-03-02 12:24:23 +01:00
|
|
|
case FT_GLYPH_FORMAT_OUTLINE:
|
|
|
|
/* translate the loaded glyph when an internal transform is needed */
|
|
|
|
if ( loader->transformed )
|
|
|
|
FT_Outline_Translate( &slot->outline,
|
|
|
|
loader->trans_delta.x,
|
|
|
|
loader->trans_delta.y );
|
|
|
|
|
|
|
|
/* compute original horizontal phantom points (and ignore */
|
|
|
|
/* vertical ones) */
|
|
|
|
loader->pp1.x = hints->x_delta;
|
|
|
|
loader->pp1.y = hints->y_delta;
|
|
|
|
loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,
|
|
|
|
hints->x_scale ) + hints->x_delta;
|
|
|
|
loader->pp2.y = hints->y_delta;
|
|
|
|
|
|
|
|
/* be sure to check for spacing glyphs */
|
|
|
|
if ( slot->outline.n_points == 0 )
|
|
|
|
goto Hint_Metrics;
|
|
|
|
|
|
|
|
/* now load the slot image into the auto-outline and run the */
|
|
|
|
/* automatic hinting process */
|
2013-07-31 22:49:29 +02:00
|
|
|
{
|
|
|
|
#ifdef FT_CONFIG_OPTION_PIC
|
2013-12-19 15:24:17 +01:00
|
|
|
AF_FaceGlobals globals = loader->globals;
|
2013-07-31 22:49:29 +02:00
|
|
|
#endif
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
AF_StyleClass style_class = metrics->style_class;
|
2013-07-31 22:49:29 +02:00
|
|
|
AF_WritingSystemClass writing_system_class =
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system];
|
2013-07-31 22:49:29 +02:00
|
|
|
|
|
|
|
|
2013-12-18 12:53:01 +01:00
|
|
|
if ( writing_system_class->style_hints_apply )
|
2015-09-03 06:47:30 +02:00
|
|
|
writing_system_class->style_hints_apply( glyph_index,
|
|
|
|
hints,
|
2015-01-14 19:07:54 +01:00
|
|
|
&gloader->base.outline,
|
2013-12-18 12:53:01 +01:00
|
|
|
metrics );
|
2013-07-31 22:49:29 +02:00
|
|
|
}
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2011-02-26 17:32:38 +01:00
|
|
|
/* we now need to adjust the metrics according to the change in */
|
|
|
|
/* width/positioning that occurred during the hinting process */
|
2007-01-26 16:05:41 +01:00
|
|
|
if ( scaler->render_mode != FT_RENDER_MODE_LIGHT )
|
2005-03-02 12:24:23 +01:00
|
|
|
{
|
2007-05-15 08:49:37 +02:00
|
|
|
FT_Pos old_rsb, old_lsb, new_lsb;
|
2005-03-02 12:24:23 +01:00
|
|
|
FT_Pos pp1x_uh, pp2x_uh;
|
2005-03-03 18:09:08 +01:00
|
|
|
AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ];
|
2005-03-02 12:24:23 +01:00
|
|
|
AF_Edge edge1 = axis->edges; /* leftmost edge */
|
|
|
|
AF_Edge edge2 = edge1 +
|
|
|
|
axis->num_edges - 1; /* rightmost edge */
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2006-01-22 08:09:54 +01:00
|
|
|
|
2006-02-09 15:17:04 +01:00
|
|
|
if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )
|
2005-03-02 12:24:23 +01:00
|
|
|
{
|
2009-04-27 19:40:35 +02:00
|
|
|
old_rsb = loader->pp2.x - edge2->opos;
|
|
|
|
old_lsb = edge1->opos;
|
|
|
|
new_lsb = edge1->pos;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/* remember unhinted values to later account */
|
|
|
|
/* for rounding errors */
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
pp1x_uh = new_lsb - old_lsb;
|
|
|
|
pp2x_uh = edge2->pos + old_rsb;
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/* prefer too much space over too little space */
|
|
|
|
/* for very small sizes */
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
if ( old_lsb < 24 )
|
2007-02-12 22:28:21 +01:00
|
|
|
pp1x_uh -= 8;
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
if ( old_rsb < 24 )
|
2007-02-12 22:28:21 +01:00
|
|
|
pp2x_uh += 8;
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
loader->pp1.x = FT_PIX_ROUND( pp1x_uh );
|
|
|
|
loader->pp2.x = FT_PIX_ROUND( pp2x_uh );
|
2004-06-05 08:27:08 +02:00
|
|
|
|
2007-02-12 22:28:21 +01:00
|
|
|
if ( loader->pp1.x >= new_lsb && old_lsb > 0 )
|
2006-12-07 22:18:09 +01:00
|
|
|
loader->pp1.x -= 64;
|
|
|
|
|
2007-02-12 22:28:21 +01:00
|
|
|
if ( loader->pp2.x <= edge2->pos && old_rsb > 0 )
|
2006-12-07 22:18:09 +01:00
|
|
|
loader->pp2.x += 64;
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
slot->lsb_delta = loader->pp1.x - pp1x_uh;
|
|
|
|
slot->rsb_delta = loader->pp2.x - pp2x_uh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-27 19:40:35 +02:00
|
|
|
FT_Pos pp1x = loader->pp1.x;
|
|
|
|
FT_Pos pp2x = loader->pp2.x;
|
|
|
|
|
2006-03-23 21:58:20 +01:00
|
|
|
|
2007-01-26 16:05:41 +01:00
|
|
|
loader->pp1.x = FT_PIX_ROUND( pp1x );
|
|
|
|
loader->pp2.x = FT_PIX_ROUND( pp2x );
|
2006-03-23 21:58:20 +01:00
|
|
|
|
|
|
|
slot->lsb_delta = loader->pp1.x - pp1x;
|
|
|
|
slot->rsb_delta = loader->pp2.x - pp2x;
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
2005-03-02 12:24:23 +01:00
|
|
|
}
|
2007-01-26 16:05:41 +01:00
|
|
|
else
|
|
|
|
{
|
2009-04-27 19:40:35 +02:00
|
|
|
FT_Pos pp1x = loader->pp1.x;
|
|
|
|
FT_Pos pp2x = loader->pp2.x;
|
|
|
|
|
2007-01-26 16:05:41 +01:00
|
|
|
|
|
|
|
loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
|
2007-01-30 11:33:53 +01:00
|
|
|
loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
|
2007-01-26 16:05:41 +01:00
|
|
|
|
|
|
|
slot->lsb_delta = loader->pp1.x - pp1x;
|
|
|
|
slot->rsb_delta = loader->pp2.x - pp2x;
|
|
|
|
}
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
break;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
default:
|
|
|
|
/* we don't support other formats (yet?) */
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Unimplemented_Feature );
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Hint_Metrics:
|
|
|
|
{
|
2006-02-27 10:18:07 +01:00
|
|
|
FT_BBox bbox;
|
|
|
|
FT_Vector vvector;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
|
2006-02-27 10:18:07 +01:00
|
|
|
vvector.x = slot->metrics.vertBearingX - slot->metrics.horiBearingX;
|
|
|
|
vvector.y = slot->metrics.vertBearingY - slot->metrics.horiBearingY;
|
|
|
|
vvector.x = FT_MulFix( vvector.x, metrics->scaler.x_scale );
|
|
|
|
vvector.y = FT_MulFix( vvector.y, metrics->scaler.y_scale );
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* transform the hinted outline if needed */
|
|
|
|
if ( loader->transformed )
|
2006-02-27 10:18:07 +01:00
|
|
|
{
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );
|
2006-02-27 10:18:07 +01:00
|
|
|
FT_Vector_Transform( &vvector, &loader->trans_matrix );
|
|
|
|
}
|
2007-06-11 07:37:35 +02:00
|
|
|
#if 1
|
2004-03-27 09:43:17 +01:00
|
|
|
/* we must translate our final outline by -pp1.x and compute */
|
|
|
|
/* the new metrics */
|
|
|
|
if ( loader->pp1.x )
|
|
|
|
FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );
|
2007-06-11 07:37:35 +02:00
|
|
|
#endif
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
|
|
|
|
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
|
|
|
|
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
|
|
|
|
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
slot->metrics.width = bbox.xMax - bbox.xMin;
|
|
|
|
slot->metrics.height = bbox.yMax - bbox.yMin;
|
|
|
|
slot->metrics.horiBearingX = bbox.xMin;
|
|
|
|
slot->metrics.horiBearingY = bbox.yMax;
|
|
|
|
|
2006-02-27 10:18:07 +01:00
|
|
|
slot->metrics.vertBearingX = FT_PIX_FLOOR( bbox.xMin + vvector.x );
|
|
|
|
slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* for mono-width fonts (like Andale, Courier, etc.) we need */
|
2009-04-27 19:40:35 +02:00
|
|
|
/* to keep the original rounded advance width; ditto for */
|
|
|
|
/* digits if all have the same advance width */
|
2004-03-27 09:43:17 +01:00
|
|
|
#if 0
|
|
|
|
if ( !FT_IS_FIXED_WIDTH( slot->face ) )
|
|
|
|
slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
|
|
|
|
else
|
|
|
|
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
|
|
|
|
x_scale );
|
|
|
|
#else
|
2012-02-29 13:33:33 +01:00
|
|
|
if ( scaler->render_mode != FT_RENDER_MODE_LIGHT &&
|
|
|
|
( FT_IS_FIXED_WIDTH( slot->face ) ||
|
|
|
|
( af_face_globals_is_digit( loader->globals, glyph_index ) &&
|
|
|
|
metrics->digits_have_same_width ) ) )
|
2007-03-26 15:37:17 +02:00
|
|
|
{
|
2004-06-04 19:41:59 +02:00
|
|
|
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
|
|
|
|
metrics->scaler.x_scale );
|
2007-03-26 15:37:17 +02:00
|
|
|
|
2007-03-28 23:17:11 +02:00
|
|
|
/* Set delta values to 0. Otherwise code that uses them is */
|
|
|
|
/* going to ruin the fixed advance width. */
|
2007-03-26 15:37:17 +02:00
|
|
|
slot->lsb_delta = 0;
|
|
|
|
slot->rsb_delta = 0;
|
|
|
|
}
|
2009-04-27 19:40:35 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* non-spacing glyphs must stay as-is */
|
|
|
|
if ( slot->metrics.horiAdvance )
|
|
|
|
slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
|
|
|
|
}
|
2004-03-27 09:43:17 +01:00
|
|
|
#endif
|
|
|
|
|
2006-02-27 10:18:07 +01:00
|
|
|
slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,
|
2011-02-26 17:32:38 +01:00
|
|
|
metrics->scaler.y_scale );
|
2006-02-27 10:18:07 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
|
2006-02-27 10:18:07 +01:00
|
|
|
slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance );
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2015-01-14 19:07:54 +01:00
|
|
|
#if 0
|
2012-02-17 14:55:27 +01:00
|
|
|
/* reassign all outline fields except flags to protect them */
|
|
|
|
slot->outline.n_contours = internal->loader->base.outline.n_contours;
|
|
|
|
slot->outline.n_points = internal->loader->base.outline.n_points;
|
|
|
|
slot->outline.points = internal->loader->base.outline.points;
|
|
|
|
slot->outline.tags = internal->loader->base.outline.tags;
|
|
|
|
slot->outline.contours = internal->loader->base.outline.contours;
|
2015-01-14 19:07:54 +01:00
|
|
|
#endif
|
2012-02-17 14:55:27 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
slot->format = FT_GLYPH_FORMAT_OUTLINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-26 17:32:38 +01:00
|
|
|
/* Load a glyph. */
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2015-01-14 16:01:19 +01:00
|
|
|
af_loader_load_glyph( AF_Loader loader,
|
|
|
|
AF_Module module,
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Face face,
|
|
|
|
FT_UInt gindex,
|
2012-02-07 09:40:11 +01:00
|
|
|
FT_Int32 load_flags )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
|
|
|
FT_Error error;
|
2012-09-14 12:26:57 +02:00
|
|
|
FT_Size size = face->size;
|
2004-03-27 09:43:17 +01:00
|
|
|
AF_ScalerRec scaler;
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
if ( !size )
|
2014-11-25 11:31:51 +01:00
|
|
|
return FT_THROW( Invalid_Size_Handle );
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
FT_ZERO( &scaler );
|
|
|
|
|
|
|
|
scaler.face = face;
|
|
|
|
scaler.x_scale = size->metrics.x_scale;
|
|
|
|
scaler.x_delta = 0; /* XXX: TODO: add support for sub-pixel hinting */
|
|
|
|
scaler.y_scale = size->metrics.y_scale;
|
|
|
|
scaler.y_delta = 0; /* XXX: TODO: add support for sub-pixel hinting */
|
|
|
|
|
|
|
|
scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );
|
|
|
|
scaler.flags = 0; /* XXX: fix this */
|
|
|
|
|
2015-01-14 16:01:19 +01:00
|
|
|
error = af_loader_reset( loader, module, face );
|
2004-03-27 09:43:17 +01:00
|
|
|
if ( !error )
|
|
|
|
{
|
2013-12-18 12:59:35 +01:00
|
|
|
AF_StyleMetrics metrics;
|
2013-12-31 09:45:10 +01:00
|
|
|
FT_UInt options = AF_STYLE_NONE_DFLT;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2007-06-11 23:15:09 +02:00
|
|
|
|
2007-06-11 07:37:35 +02:00
|
|
|
#ifdef FT_OPTION_AUTOFIT2
|
2013-07-31 22:49:29 +02:00
|
|
|
/* XXX: undocumented hook to activate the latin2 writing system */
|
2007-06-11 23:15:09 +02:00
|
|
|
if ( load_flags & ( 1UL << 20 ) )
|
2013-12-31 09:45:10 +01:00
|
|
|
options = AF_STYLE_LTN2_DFLT;
|
2007-06-11 07:37:35 +02:00
|
|
|
#endif
|
2005-03-02 12:24:23 +01:00
|
|
|
|
|
|
|
error = af_face_globals_get_metrics( loader->globals, gindex,
|
2007-06-11 07:37:35 +02:00
|
|
|
options, &metrics );
|
2004-03-27 09:43:17 +01:00
|
|
|
if ( !error )
|
|
|
|
{
|
2013-07-31 22:49:29 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_PIC
|
2013-12-19 15:24:17 +01:00
|
|
|
AF_FaceGlobals globals = loader->globals;
|
2013-07-31 22:49:29 +02:00
|
|
|
#endif
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
AF_StyleClass style_class = metrics->style_class;
|
2013-07-31 22:49:29 +02:00
|
|
|
AF_WritingSystemClass writing_system_class =
|
[autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.
* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.
* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.
* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.
* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition. This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.
* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.
* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.
* src/autofit/afranges.h: Updated.
* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
|
|
|
AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system];
|
2013-07-31 22:49:29 +02:00
|
|
|
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->metrics = metrics;
|
|
|
|
|
2013-12-18 12:53:01 +01:00
|
|
|
if ( writing_system_class->style_metrics_scale )
|
|
|
|
writing_system_class->style_metrics_scale( metrics, &scaler );
|
2005-03-01 16:48:29 +01:00
|
|
|
else
|
|
|
|
metrics->scaler = scaler;
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;
|
|
|
|
load_flags &= ~FT_LOAD_RENDER;
|
|
|
|
|
2013-12-18 12:53:01 +01:00
|
|
|
if ( writing_system_class->style_hints_init )
|
2008-02-17 09:22:08 +01:00
|
|
|
{
|
2015-01-14 19:16:12 +01:00
|
|
|
error = writing_system_class->style_hints_init( loader->hints,
|
2013-12-18 12:53:01 +01:00
|
|
|
metrics );
|
2008-02-17 09:22:08 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
}
|
2004-06-04 19:41:59 +02:00
|
|
|
|
2015-01-14 18:55:39 +01:00
|
|
|
error = af_loader_load_g( loader, &scaler, gindex, load_flags );
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
}
|
2004-06-04 19:41:59 +02:00
|
|
|
Exit:
|
2004-03-27 09:43:17 +01:00
|
|
|
return error;
|
|
|
|
}
|
2005-03-02 12:24:23 +01:00
|
|
|
|
|
|
|
|
2015-11-02 13:12:34 +01:00
|
|
|
/*
|
|
|
|
* Compute amount of font units the face should be emboldened by, in
|
|
|
|
* analogy to the CFF driver's `cf2_computeDarkening' function. See there
|
|
|
|
* for details of the algorithm.
|
|
|
|
*
|
|
|
|
* XXX: Currently a crude adaption of the original algorithm. Do better?
|
|
|
|
*/
|
|
|
|
#define af_intToFixed( i ) \
|
|
|
|
( (FT_Fixed)( (FT_UInt32)(i) << 16 ) )
|
|
|
|
#define af_fixedToInt( x ) \
|
|
|
|
( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
|
|
|
|
#define af_floatToFixed( f ) \
|
|
|
|
( (FT_Fixed)( (f) * 65536.0 + 0.5 ) )
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Int32 )
|
|
|
|
af_loader_compute_darkening( AF_Loader loader,
|
|
|
|
FT_Face face,
|
|
|
|
FT_Pos standard_width )
|
|
|
|
{
|
|
|
|
AF_Module module = loader->globals->module;
|
|
|
|
|
|
|
|
FT_UShort units_per_EM;
|
|
|
|
FT_Fixed ppem, em_ratio;
|
|
|
|
FT_Fixed stem_width, stem_width_per_1000, scaled_stem, darken_amount;
|
|
|
|
FT_Int log_base_2;
|
|
|
|
FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
|
|
|
|
|
|
|
|
|
|
|
|
ppem = FT_MAX( af_intToFixed( 4 ),
|
|
|
|
af_intToFixed( face->size->metrics.x_ppem ) );
|
|
|
|
units_per_EM = face->units_per_EM;
|
|
|
|
|
|
|
|
em_ratio = FT_DivFix( af_intToFixed( 1000 ),
|
|
|
|
af_intToFixed ( units_per_EM ) );
|
|
|
|
if ( em_ratio < af_floatToFixed( .01 ) )
|
|
|
|
{
|
|
|
|
/* If something goes wrong, don't embolden. */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
x1 = module->darken_params[0];
|
|
|
|
y1 = module->darken_params[1];
|
|
|
|
x2 = module->darken_params[2];
|
|
|
|
y2 = module->darken_params[3];
|
|
|
|
x3 = module->darken_params[4];
|
|
|
|
y3 = module->darken_params[5];
|
|
|
|
x4 = module->darken_params[6];
|
|
|
|
y4 = module->darken_params[7];
|
|
|
|
|
|
|
|
if ( standard_width <= 0 )
|
|
|
|
{
|
|
|
|
stem_width = af_intToFixed( 75 ); /* taken from cf2font.c */
|
|
|
|
stem_width_per_1000 = stem_width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stem_width = af_intToFixed( standard_width );
|
|
|
|
stem_width_per_1000 = FT_MulFix( stem_width, em_ratio );
|
|
|
|
}
|
|
|
|
|
|
|
|
log_base_2 = FT_MSB( (FT_UInt32)stem_width_per_1000 ) +
|
|
|
|
FT_MSB( (FT_UInt32)ppem );
|
|
|
|
|
|
|
|
if ( log_base_2 >= 46 )
|
|
|
|
{
|
|
|
|
/* possible overflow */
|
|
|
|
scaled_stem = af_intToFixed( x4 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
scaled_stem = FT_MulFix( stem_width_per_1000, ppem );
|
|
|
|
|
|
|
|
/* now apply the darkening parameters */
|
|
|
|
if ( scaled_stem < af_intToFixed( x1 ) )
|
|
|
|
darken_amount = FT_DivFix( af_intToFixed( y1 ), ppem );
|
|
|
|
|
|
|
|
else if ( scaled_stem < af_intToFixed( x2 ) )
|
|
|
|
{
|
|
|
|
FT_Int xdelta = x2 - x1;
|
|
|
|
FT_Int ydelta = y2 - y1;
|
|
|
|
FT_Int x = stem_width_per_1000 -
|
|
|
|
FT_DivFix( af_intToFixed( x1 ), ppem );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !xdelta )
|
|
|
|
goto Try_x3;
|
|
|
|
|
|
|
|
darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
|
|
|
|
FT_DivFix( af_intToFixed( y1 ), ppem );
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( scaled_stem < af_intToFixed( x3 ) )
|
|
|
|
{
|
|
|
|
Try_x3:
|
|
|
|
{
|
|
|
|
FT_Int xdelta = x3 - x2;
|
|
|
|
FT_Int ydelta = y3 - y2;
|
|
|
|
FT_Int x = stem_width_per_1000 -
|
|
|
|
FT_DivFix( af_intToFixed( x2 ), ppem );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !xdelta )
|
|
|
|
goto Try_x4;
|
|
|
|
|
|
|
|
darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
|
|
|
|
FT_DivFix( af_intToFixed( y2 ), ppem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( scaled_stem < af_intToFixed( x4 ) )
|
|
|
|
{
|
|
|
|
Try_x4:
|
|
|
|
{
|
|
|
|
FT_Int xdelta = x4 - x3;
|
|
|
|
FT_Int ydelta = y4 - y3;
|
|
|
|
FT_Int x = stem_width_per_1000 -
|
|
|
|
FT_DivFix( af_intToFixed( x3 ), ppem );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !xdelta )
|
|
|
|
goto Use_y4;
|
|
|
|
|
|
|
|
darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
|
|
|
|
FT_DivFix( af_intToFixed( y3 ), ppem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Use_y4:
|
|
|
|
darken_amount = FT_DivFix( af_intToFixed( y4 ), ppem );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert darken_amount from per 1000 em to true character space. */
|
|
|
|
return af_fixedToInt( FT_DivFix( darken_amount, em_ratio ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/* END */
|