From 0d97744d81dc8cc56990b3ee366506826beaf2f0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 4 Jan 2014 11:46:34 +0100 Subject: [PATCH] [autofit] Fix Indic scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split the single, incorrect Indic entry into separate scripts so that the covered ranges are the same: Bengali, Devanagari, Gujarati, Gurmukhi, Kannada, Limbu, Malayalam, Oriya, Sinhala, Sundanese, Syloti Nagri, Tamil, Telugu, and Tibetan. At the same time, remove entries for Meetai Mayak and Sharada – the Unicode ranges were incorrect (and nobody has complained about that), fonts are scarce for those scripts, and the Indic auto-hinter support is rudimentary anyways. * src/autofit/afscript.h: Updated, using AF_CONFIG_OPTION_INDIC and AF_CONFIG_OPTION_CJK. * src/autofit/afstyles.h (STYLE_DEFAULT_INDIC): New auxiliary macro. Use it, together with AF_CONFIG_OPTION_INDIC and AF_CONFIG_OPTION_CJK, to update. * src/autofit/afranges.c [AF_CONFIG_OPTION_INDIC]: Updated. [!AF_CONFIG_OPTION_INDIC, !AF_CONFIG_OPTION_CJK]: Removed. Sort entries by tags. --- ChangeLog | 24 +++++ src/autofit/afranges.c | 202 ++++++++++++++++++++++++++--------------- src/autofit/afscript.h | 105 +++++++++++++++++---- src/autofit/afstyles.h | 57 ++++++++---- 4 files changed, 281 insertions(+), 107 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a6829ab0..861e0b2f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2014-01-04 Werner Lemberg + + [autofit] Fix Indic scripts. + + Split the single, incorrect Indic entry into separate scripts so + that the covered ranges are the same: Bengali, Devanagari, Gujarati, + Gurmukhi, Kannada, Limbu, Malayalam, Oriya, Sinhala, Sundanese, + Syloti Nagri, Tamil, Telugu, and Tibetan. At the same time, remove + entries for Meetai Mayak and Sharada – the Unicode ranges were + incorrect (and nobody has complained about that), fonts are scarce + for those scripts, and the Indic auto-hinter support is rudimentary + anyways. + + * src/autofit/afscript.h: Updated, using AF_CONFIG_OPTION_INDIC and + AF_CONFIG_OPTION_CJK. + + * src/autofit/afstyles.h (STYLE_DEFAULT_INDIC): New auxiliary macro. + Use it, together with AF_CONFIG_OPTION_INDIC and + AF_CONFIG_OPTION_CJK, to update. + + * src/autofit/afranges.c [AF_CONFIG_OPTION_INDIC]: Updated. + [!AF_CONFIG_OPTION_INDIC, !AF_CONFIG_OPTION_CJK]: Removed. + Sort entries by tags. + 2014-01-03 Werner Lemberg [autofit] Thinko. diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c index 607733c4d..3d919b5a4 100644 --- a/src/autofit/afranges.c +++ b/src/autofit/afranges.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter Unicode script ranges (body). */ /* */ -/* Copyright 2013 by */ +/* Copyright 2013, 2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,9 +19,6 @@ #include "afranges.h" - /* XXX: this should probably fine tuned to differentiate better between */ - /* scripts... */ - const AF_Script_UniRangeRec af_cyrl_uniranges[] = { AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ @@ -31,29 +28,6 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; -#ifdef AF_CONFIG_OPTION_INDIC - - const AF_Script_UniRangeRec af_deva_uniranges[] = - { - AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL ), /* Indic Range */ - AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */ - AF_UNIRANGE_REC( 0x1900UL, 0x194FUL ), /* Limbu */ - AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ - AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL ), /* Meetei Mayak */ - AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL ), /* Syloti Nagri */ - AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL ), /* Sharada */ - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - -#else /* !AF_CONFIG_OPTION_INDIC */ - - const AF_Script_UniRangeRec af_deva_uniranges[] = - { - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - -#endif /* !AF_CONFIG_OPTION_INDIC */ - const AF_Script_UniRangeRec af_grek_uniranges[] = { AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ @@ -61,6 +35,133 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; + const AF_Script_UniRangeRec af_hebr_uniranges[] = + { + AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ + AF_UNIRANGE_REC( 0xFB1DUL, 0xFB4FUL ), /* Alphab. Present. Forms (Hebrew) */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_latn_uniranges[] = + { + AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ + AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ + AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ + AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ + AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ + AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ + AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ + AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ + AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ + AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ + AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ + AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ + AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ + AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ + AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ + AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ + AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ + AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ + AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ + AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ + AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ + AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_none_uniranges[] = + { + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + +#ifdef AF_CONFIG_OPTION_INDIC + + const AF_Script_UniRangeRec af_beng_uniranges[] = + { + AF_UNIRANGE_REC( 0x0980UL, 0x09FFUL ), /* Bengali */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_deva_uniranges[] = + { + AF_UNIRANGE_REC( 0x0900UL, 0x097FUL ), /* Devanagari */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_gujr_uniranges[] = + { + AF_UNIRANGE_REC( 0x0A80UL, 0x0AFFUL ), /* Gujarati */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_guru_uniranges[] = + { + AF_UNIRANGE_REC( 0x0A00UL, 0x0A7FUL ), /* Gurmukhi */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_knda_uniranges[] = + { + AF_UNIRANGE_REC( 0x0C80UL, 0x0CFFUL ), /* Kannada */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_limb_uniranges[] = + { + AF_UNIRANGE_REC( 0x1900UL, 0x194FUL ), /* Limbu */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_mlym_uniranges[] = + { + AF_UNIRANGE_REC( 0x0D00UL, 0x0D7FUL ), /* Malayalam */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_orya_uniranges[] = + { + AF_UNIRANGE_REC( 0x0B00UL, 0x0B7FUL ), /* Oriya */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sinh_uniranges[] = + { + AF_UNIRANGE_REC( 0x0D80UL, 0x0DFFUL ), /* Sinhala */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sund_uniranges[] = + { + AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_sylo_uniranges[] = + { + AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL ), /* Syloti Nagri */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_taml_uniranges[] = + { + AF_UNIRANGE_REC( 0x0B80UL, 0x0BFFUL ), /* Tamil */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_telu_uniranges[] = + { + AF_UNIRANGE_REC( 0x0C00UL, 0x0C7FUL ), /* Telugu */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + + const AF_Script_UniRangeRec af_tibt_uniranges[] = + { + AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */ + AF_UNIRANGE_REC( 0UL, 0UL ) + }; + +#endif /* !AF_CONFIG_OPTION_INDIC */ + #ifdef AF_CONFIG_OPTION_CJK /* this corresponds to Unicode 6.0 */ @@ -102,53 +203,6 @@ AF_UNIRANGE_REC( 0UL, 0UL ) }; -#else /* !AF_CONFIG_OPTION_CJK */ - - const AF_Script_UniRangeRec af_hani_uniranges[] = - { - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - #endif /* !AF_CONFIG_OPTION_CJK */ - const AF_Script_UniRangeRec af_hebr_uniranges[] = - { - AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ - AF_UNIRANGE_REC( 0xFB1DUL, 0xFB4FUL ), /* Alphab. Present. Forms (Hebrew) */ - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - - const AF_Script_UniRangeRec af_latn_uniranges[] = - { - AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ - AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ - AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ - AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ - AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ - AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ - AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ - AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ - AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ - AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ - AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ - AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ - AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ - AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ - AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ - AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ - AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ - AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ - AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ - AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ - AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ - AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - - const AF_Script_UniRangeRec af_none_uniranges[] = - { - AF_UNIRANGE_REC( 0UL, 0UL ) - }; - - /* END */ diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h index a9def1838..562e15bb3 100644 --- a/src/autofit/afscript.h +++ b/src/autofit/afscript.h @@ -4,7 +4,7 @@ /* */ /* Auto-fitter scripts (specification only). */ /* */ -/* Copyright 2013 by */ +/* Copyright 2013, 2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,26 +31,11 @@ HB_SCRIPT_CYRILLIC, 0x43E ) /* о */ - SCRIPT( deva, DEVA, - "Indic scripts", - HB_SCRIPT_DEVANAGARI, - 'o' ) /* XXX */ - - SCRIPT( none, NONE, - "no script", - HB_SCRIPT_INVALID, - '\0' ) - SCRIPT( grek, GREK, "Greek", HB_SCRIPT_GREEK, 0x3BF ) /* ο */ - SCRIPT( hani, HANI, - "CJKV ideographs", - HB_SCRIPT_HAN, - 0x7530 ) /* 田 */ - SCRIPT( hebr, HEBR, "Hebrew", HB_SCRIPT_HEBREW, @@ -61,5 +46,93 @@ HB_SCRIPT_LATIN, 'o' ) + SCRIPT( none, NONE, + "no script", + HB_SCRIPT_INVALID, + '\0' ) + +#ifdef AF_CONFIG_OPTION_INDIC + + SCRIPT( beng, BENG, + "Bengali", + HB_SCRIPT_BENGALI, + 'o' ) /* XXX */ + + SCRIPT( deva, DEVA, + "Devanagari", + HB_SCRIPT_DEVANAGARI, + 'o' ) /* XXX */ + + SCRIPT( gujr, GUJR, + "Gujarati", + HB_SCRIPT_GUJARATI, + 'o' ) /* XXX */ + + SCRIPT( guru, GURU, + "Gurmukhi", + HB_SCRIPT_GURMUKHI, + 'o' ) /* XXX */ + + SCRIPT( knda, KNDA, + "Kannada", + HB_SCRIPT_KANNADA, + 'o' ) /* XXX */ + + SCRIPT( limb, LIMB, + "Limbu", + HB_SCRIPT_LIMBU, + 'o' ) /* XXX */ + + SCRIPT( mlym, MLYM, + "Malayalam", + HB_SCRIPT_MALAYALAM, + 'o' ) /* XXX */ + + SCRIPT( orya, ORYA, + "Oriya", + HB_SCRIPT_ORIYA, + 'o' ) /* XXX */ + + SCRIPT( sinh, SINH, + "Sinhala", + HB_SCRIPT_SINHALA, + 'o' ) /* XXX */ + + SCRIPT( sund, SUND, + "Sundanese", + HB_SCRIPT_SUNDANESE, + 'o' ) /* XXX */ + + SCRIPT( sylo, SYLO, + "Syloti Nagri", + HB_SCRIPT_SYLOTI_NAGRI, + 'o' ) /* XXX */ + + SCRIPT( taml, TAML, + "Tamil", + HB_SCRIPT_TAMIL, + 'o' ) /* XXX */ + + SCRIPT( telu, TELU, + "Telugu", + HB_SCRIPT_TELUGU, + 'o' ) /* XXX */ + + SCRIPT( tibt, TIBT, + "Tibetan", + HB_SCRIPT_TIBETAN, + 'o' ) /* XXX */ + +#endif /* AF_CONFIG_OPTION_INDIC */ + +#ifdef AF_CONFIG_OPTION_CJK + + SCRIPT( hani, HANI, + "CJKV ideographs", + HB_SCRIPT_HAN, + 0x7530 ) /* 田 */ + +#endif /* AF_CONFIG_OPTION_CJK */ + /* END */ diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h index 9a2c61855..429da7664 100644 --- a/src/autofit/afstyles.h +++ b/src/autofit/afstyles.h @@ -81,30 +81,13 @@ DEFAULT ) META_STYLE_LATIN( cyrl, CYRL, "Cyrillic" ) - - STYLE( deva_dflt, DEVA_DFLT, - "Indic scripts default style", - AF_WRITING_SYSTEM_INDIC, - AF_SCRIPT_DEVA, - (AF_Blue_Stringset)0, /* XXX */ - AF_COVERAGE_DEFAULT ) - META_STYLE_LATIN( grek, GREK, "Greek" ) - - STYLE( hani_dflt, HANI_DFLT, - "CJKV ideographs default style", - AF_WRITING_SYSTEM_CJK, - AF_SCRIPT_HANI, - AF_BLUE_STRINGSET_HANI, - AF_COVERAGE_DEFAULT ) - STYLE( hebr_dflt, HEBR_DFLT, "Hebrew default style", AF_WRITING_SYSTEM_LATIN, AF_SCRIPT_HEBR, AF_BLUE_STRINGSET_HEBR, AF_COVERAGE_DEFAULT ) - META_STYLE_LATIN( latn, LATN, "Latin" ) #ifdef FT_OPTION_AUTOFIT2 @@ -123,5 +106,45 @@ (AF_Blue_Stringset)0, AF_COVERAGE_DEFAULT ) +#ifdef AF_CONFIG_OPTION_INDIC + + /* no blue stringset support for the Indic writing system yet */ +#undef STYLE_DEFAULT_INDIC +#define STYLE_DEFAULT_INDIC( s, S, d ) \ + STYLE( s ## _dflt, S ## _DFLT, \ + d " default style", \ + AF_WRITING_SYSTEM_INDIC, \ + AF_SCRIPT_ ## S, \ + (AF_Blue_Stringset)0, \ + AF_COVERAGE_DEFAULT ) + + STYLE_DEFAULT_INDIC( beng, BENG, "Bengali" ) + STYLE_DEFAULT_INDIC( deva, DEVA, "Devanagari" ) + STYLE_DEFAULT_INDIC( gujr, GUJR, "Gujarati" ) + STYLE_DEFAULT_INDIC( guru, GURU, "Gurmukhi" ) + STYLE_DEFAULT_INDIC( knda, KNDA, "Kannada" ) + STYLE_DEFAULT_INDIC( limb, LIMB, "Limbu" ) + STYLE_DEFAULT_INDIC( mlym, MLYM, "Malayalam" ) + STYLE_DEFAULT_INDIC( orya, ORYA, "Oriya" ) + STYLE_DEFAULT_INDIC( sinh, SINH, "Sinhala" ) + STYLE_DEFAULT_INDIC( sund, SUND, "Sundanese" ) + STYLE_DEFAULT_INDIC( sylo, SYLO, "Syloti Nagri" ) + STYLE_DEFAULT_INDIC( taml, TAML, "Tamil" ) + STYLE_DEFAULT_INDIC( telu, TELU, "Telugu" ) + STYLE_DEFAULT_INDIC( tibt, TIBT, "Tibetan" ) + +#endif /* AF_CONFIG_OPTION_INDIC */ + +#ifdef AF_CONFIG_OPTION_CJK + + STYLE( hani_dflt, HANI_DFLT, + "CJKV ideographs default style", + AF_WRITING_SYSTEM_CJK, + AF_SCRIPT_HANI, + AF_BLUE_STRINGSET_HANI, + AF_COVERAGE_DEFAULT ) + +#endif /* AF_CONFIG_OPTION_CJK */ + /* END */