[autofit] Add functions to get standard widths for writing systems.
We need the computed standard horizontal and vertical widths for the emboldening calculation. This method provides a convenient way to extract it from writing-system-specific metrics structures, which all script definitions must implement. * src/autofit/aftypes.h (AF_WritingSystem_GetStdWidthsFunc): New function type. (AF_WritingSystemClassRec): New member `style_metrics_getstdw'. (AF_DEFINE_WRITING_SYSTEM_CLASS): Updated. * src/autofit/afcjk.c (af_cjk_get_standard_width): New function. (af_cjk_writing_system_class): Updated. * src/autofit/afdummy.c (af_dummy_writing_system_class): Updated. * src/autofit/afindic.c (af_cjk_get_standard_width): New function. (af_indic_writing_system_class): Updated. * src/autofit/aflatin.c (af_latin_get_standard_width): New function. (af_indic_writing_system_class): Updated. * src/autofit/aflatin.c (af_latin_get_standard_width): New function. (af_indic_writing_system_class): Updated.
This commit is contained in:
parent
b2a85ad32b
commit
37c401ac0a
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
||||
2015-11-02 Nikolaus Waxweiler <madigens@gmail.com>
|
||||
|
||||
[autofit] Add functions to get standard widths for writing systems.
|
||||
|
||||
We need the computed standard horizontal and vertical widths for the
|
||||
emboldening calculation. This method provides a convenient way to
|
||||
extract it from writing-system-specific metrics structures, which
|
||||
all script definitions must implement.
|
||||
|
||||
* src/autofit/aftypes.h (AF_WritingSystem_GetStdWidthsFunc): New
|
||||
function type.
|
||||
(AF_WritingSystemClassRec): New member `style_metrics_getstdw'.
|
||||
(AF_DEFINE_WRITING_SYSTEM_CLASS): Updated.
|
||||
|
||||
* src/autofit/afcjk.c (af_cjk_get_standard_width): New function.
|
||||
(af_cjk_writing_system_class): Updated.
|
||||
* src/autofit/afdummy.c (af_dummy_writing_system_class): Updated.
|
||||
* src/autofit/afindic.c (af_cjk_get_standard_width): New function.
|
||||
(af_indic_writing_system_class): Updated.
|
||||
* src/autofit/aflatin.c (af_latin_get_standard_width): New function.
|
||||
(af_indic_writing_system_class): Updated.
|
||||
* src/autofit/aflatin.c (af_latin_get_standard_width): New function.
|
||||
(af_indic_writing_system_class): Updated.
|
||||
|
||||
2015-11-02 Nikolaus Waxweiler <madigens@gmail.com>
|
||||
|
||||
[autofit] Extend `AF_FaceGlobalsRec' to hold emboldening data.
|
||||
|
@ -688,6 +688,22 @@
|
||||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_cjk_get_standard_widths( AF_CJKMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW )
|
||||
{
|
||||
if ( stdHW )
|
||||
*stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
|
||||
|
||||
if ( stdVW )
|
||||
*stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -2280,6 +2296,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) af_cjk_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_cjk_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_cjk_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_cjk_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_cjk_hints_apply
|
||||
@ -2299,6 +2316,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) NULL,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) NULL,
|
||||
(AF_WritingSystem_ApplyHintsFunc) NULL
|
||||
|
@ -65,6 +65,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) NULL,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_dummy_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_dummy_hints_apply
|
||||
|
@ -89,6 +89,22 @@
|
||||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
static void
|
||||
af_indic_get_standard_widths( AF_CJKMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW )
|
||||
{
|
||||
if ( stdHW )
|
||||
*stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
|
||||
|
||||
if ( stdVW )
|
||||
*stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -108,6 +124,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_indic_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_indic_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_indic_hints_apply
|
||||
@ -127,6 +144,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) NULL,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)NULL,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)NULL,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) NULL,
|
||||
(AF_WritingSystem_ApplyHintsFunc) NULL
|
||||
|
@ -1149,6 +1149,22 @@
|
||||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_latin_get_standard_widths( AF_LatinMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW )
|
||||
{
|
||||
if ( stdHW )
|
||||
*stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
|
||||
|
||||
if ( stdVW )
|
||||
*stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -2944,6 +2960,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) af_latin_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_latin_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_latin_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_latin_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_latin_hints_apply
|
||||
|
@ -693,6 +693,22 @@
|
||||
}
|
||||
|
||||
|
||||
/* Extract standard_width from writing system/script specific */
|
||||
/* metrics class. */
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
af_latin2_get_standard_widths( AF_LatinMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW )
|
||||
{
|
||||
if ( stdHW )
|
||||
*stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width;
|
||||
|
||||
if ( stdVW )
|
||||
*stdVW = metrics->axis[AF_DIMENSION_HORZ].standard_width;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -2392,6 +2408,7 @@
|
||||
(AF_WritingSystem_InitMetricsFunc) af_latin2_metrics_init,
|
||||
(AF_WritingSystem_ScaleMetricsFunc)af_latin2_metrics_scale,
|
||||
(AF_WritingSystem_DoneMetricsFunc) NULL,
|
||||
(AF_WritingSystem_GetStdWidthsFunc)af_latin2_get_standard_widths,
|
||||
|
||||
(AF_WritingSystem_InitHintsFunc) af_latin2_hints_init,
|
||||
(AF_WritingSystem_ApplyHintsFunc) af_latin2_hints_apply
|
||||
|
@ -211,6 +211,11 @@ extern void* _af_debug_hints;
|
||||
typedef void
|
||||
(*AF_WritingSystem_DoneMetricsFunc)( AF_StyleMetrics metrics );
|
||||
|
||||
typedef void
|
||||
(*AF_WritingSystem_GetStdWidthsFunc)( AF_StyleMetrics metrics,
|
||||
FT_Pos* stdHW,
|
||||
FT_Pos* stdVW );
|
||||
|
||||
|
||||
typedef FT_Error
|
||||
(*AF_WritingSystem_InitHintsFunc)( AF_GlyphHints hints,
|
||||
@ -276,6 +281,7 @@ extern void* _af_debug_hints;
|
||||
AF_WritingSystem_InitMetricsFunc style_metrics_init;
|
||||
AF_WritingSystem_ScaleMetricsFunc style_metrics_scale;
|
||||
AF_WritingSystem_DoneMetricsFunc style_metrics_done;
|
||||
AF_WritingSystem_GetStdWidthsFunc style_metrics_getstdw;
|
||||
|
||||
AF_WritingSystem_InitHintsFunc style_hints_init;
|
||||
AF_WritingSystem_ApplyHintsFunc style_hints_apply;
|
||||
@ -489,6 +495,7 @@ extern void* _af_debug_hints;
|
||||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
h_init, \
|
||||
h_apply ) \
|
||||
FT_CALLBACK_TABLE_DEF \
|
||||
@ -501,6 +508,7 @@ extern void* _af_debug_hints;
|
||||
m_init, \
|
||||
m_scale, \
|
||||
m_done, \
|
||||
m_stdw, \
|
||||
\
|
||||
h_init, \
|
||||
h_apply \
|
||||
@ -570,16 +578,17 @@ extern void* _af_debug_hints;
|
||||
FT_LOCAL_DEF( void ) \
|
||||
FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \
|
||||
{ \
|
||||
ac->writing_system = system; \
|
||||
ac->writing_system = system; \
|
||||
\
|
||||
ac->style_metrics_size = m_size; \
|
||||
ac->style_metrics_size = m_size; \
|
||||
\
|
||||
ac->style_metrics_init = m_init; \
|
||||
ac->style_metrics_scale = m_scale; \
|
||||
ac->style_metrics_done = m_done; \
|
||||
ac->style_metrics_init = m_init; \
|
||||
ac->style_metrics_scale = m_scale; \
|
||||
ac->style_metrics_done = m_done; \
|
||||
ac->style_metrics_getstdw = m_stdw; \
|
||||
\
|
||||
ac->style_hints_init = h_init; \
|
||||
ac->style_hints_apply = h_apply; \
|
||||
ac->style_hints_init = h_init; \
|
||||
ac->style_hints_apply = h_apply; \
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user