summaryrefslogtreecommitdiffstats
path: root/src/autofit
diff options
context:
space:
mode:
Diffstat (limited to 'src/autofit')
-rw-r--r--src/autofit/afblue.c233
-rw-r--r--src/autofit/afblue.dat295
-rw-r--r--src/autofit/afblue.h183
-rw-r--r--src/autofit/afblue.hin62
-rw-r--r--src/autofit/afcjk.c193
-rw-r--r--src/autofit/afcjk.h3
-rw-r--r--src/autofit/afdummy.c6
-rw-r--r--src/autofit/afglobal.c107
-rw-r--r--src/autofit/afglobal.h37
-rw-r--r--src/autofit/afhints.c144
-rw-r--r--src/autofit/afindic.c23
-rw-r--r--src/autofit/aflatin.c1038
-rw-r--r--src/autofit/aflatin.h10
-rw-r--r--src/autofit/aflatin2.c22
-rw-r--r--src/autofit/afloader.c271
-rw-r--r--src/autofit/afloader.h5
-rw-r--r--src/autofit/afmodule.c95
-rw-r--r--src/autofit/afmodule.h2
-rw-r--r--src/autofit/afpic.c2
-rw-r--r--src/autofit/afpic.h8
-rw-r--r--src/autofit/afranges.c440
-rw-r--r--src/autofit/afranges.h8
-rw-r--r--src/autofit/afscript.h80
-rw-r--r--src/autofit/afshaper.c676
-rw-r--r--src/autofit/afshaper.h71
-rw-r--r--src/autofit/afstyles.h55
-rw-r--r--src/autofit/aftypes.h71
-rw-r--r--src/autofit/afwarp.c2
-rw-r--r--src/autofit/afwarp.h2
-rw-r--r--src/autofit/autofit.c2
30 files changed, 3299 insertions, 847 deletions
diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c
index e2b2451..104ee17 100644
--- a/src/autofit/afblue.c
+++ b/src/autofit/afblue.c
@@ -26,107 +26,161 @@
af_blue_strings[] =
{
/* */
- '\xD8', '\xA7', '\xD8', '\xA5', '\xD9', '\x84', '\xD9', '\x83', '\xD8', '\xB7', '\xD8', '\xB8', /* ا إ ل ك ط ظ */
+ '\xD8', '\xA7', ' ', '\xD8', '\xA5', ' ', '\xD9', '\x84', ' ', '\xD9', '\x83', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', /* ا إ ل ك ط ظ */
'\0',
- '\xD8', '\xAA', '\xD8', '\xAB', '\xD8', '\xB7', '\xD8', '\xB8', '\xD9', '\x83', /* ت ث ط ظ ك */
+ '\xD8', '\xAA', ' ', '\xD8', '\xAB', ' ', '\xD8', '\xB7', ' ', '\xD8', '\xB8', ' ', '\xD9', '\x83', /* ت ث ط ظ ك */
'\0',
- '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\x9F', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕПЗОСЭ */
+ '\xD9', '\x80', /* ـ */
'\0',
- '\xD0', '\x91', '\xD0', '\x92', '\xD0', '\x95', '\xD0', '\xA8', '\xD0', '\x97', '\xD0', '\x9E', '\xD0', '\xA1', '\xD0', '\xAD', /* БВЕШЗОСЭ */
+ '\xD0', '\x91', ' ', '\xD0', '\x92', ' ', '\xD0', '\x95', ' ', '\xD0', '\x9F', ' ', '\xD0', '\x97', ' ', '\xD0', '\x9E', ' ', '\xD0', '\xA1', ' ', '\xD0', '\xAD', /* Б В Е П З О С Э */
'\0',
- '\xD1', '\x85', '\xD0', '\xBF', '\xD0', '\xBD', '\xD1', '\x88', '\xD0', '\xB5', '\xD0', '\xB7', '\xD0', '\xBE', '\xD1', '\x81', /* хпншезос */
+ '\xD0', '\x91', ' ', '\xD0', '\x92', ' ', '\xD0', '\x95', ' ', '\xD0', '\xA8', ' ', '\xD0', '\x97', ' ', '\xD0', '\x9E', ' ', '\xD0', '\xA1', ' ', '\xD0', '\xAD', /* Б В Е Ш З О С Э */
'\0',
- '\xD1', '\x80', '\xD1', '\x83', '\xD1', '\x84', /* руф */
+ '\xD1', '\x85', ' ', '\xD0', '\xBF', ' ', '\xD0', '\xBD', ' ', '\xD1', '\x88', ' ', '\xD0', '\xB5', ' ', '\xD0', '\xB7', ' ', '\xD0', '\xBE', ' ', '\xD1', '\x81', /* х п н ш е з о с */
'\0',
- '\xE0', '\xA4', '\x95', '\xE0', '\xA4', '\xAE', '\xE0', '\xA4', '\x85', '\xE0', '\xA4', '\x86', '\xE0', '\xA4', '\xA5', '\xE0', '\xA4', '\xA7', '\xE0', '\xA4', '\xAD', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
+ '\xD1', '\x80', ' ', '\xD1', '\x83', ' ', '\xD1', '\x84', /* р у ф */
'\0',
- '\xE0', '\xA4', '\x88', '\xE0', '\xA4', '\x90', '\xE0', '\xA4', '\x93', '\xE0', '\xA4', '\x94', '\xE0', '\xA4', '\xBF', '\xE0', '\xA5', '\x80', '\xE0', '\xA5', '\x8B', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */
+ '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
'\0',
- '\xE0', '\xA4', '\x95', '\xE0', '\xA4', '\xAE', '\xE0', '\xA4', '\x85', '\xE0', '\xA4', '\x86', '\xE0', '\xA4', '\xA5', '\xE0', '\xA4', '\xA7', '\xE0', '\xA4', '\xAD', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
+ '\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */
'\0',
- '\xE0', '\xA5', '\x81', '\xE0', '\xA5', '\x83', /* ु ृ */
+ '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
'\0',
- '\xCE', '\x93', '\xCE', '\x92', '\xCE', '\x95', '\xCE', '\x96', '\xCE', '\x98', '\xCE', '\x9F', '\xCE', '\xA9', /* ΓΒΕΖΘΟΩ */
+ '\xE0', '\xA5', '\x81', ' ', '\xE0', '\xA5', '\x83', /* ु ृ */
'\0',
- '\xCE', '\x92', '\xCE', '\x94', '\xCE', '\x96', '\xCE', '\x9E', '\xCE', '\x98', '\xCE', '\x9F', /* ΒΔΖΞΘΟ */
+ '\xCE', '\x93', ' ', '\xCE', '\x92', ' ', '\xCE', '\x95', ' ', '\xCE', '\x96', ' ', '\xCE', '\x98', ' ', '\xCE', '\x9F', ' ', '\xCE', '\xA9', /* Γ Β Ε Ζ Θ Ο Ω */
'\0',
- '\xCE', '\xB2', '\xCE', '\xB8', '\xCE', '\xB4', '\xCE', '\xB6', '\xCE', '\xBB', '\xCE', '\xBE', /* βθδζλξ */
+ '\xCE', '\x92', ' ', '\xCE', '\x94', ' ', '\xCE', '\x96', ' ', '\xCE', '\x9E', ' ', '\xCE', '\x98', ' ', '\xCE', '\x9F', /* Β Δ Ζ Ξ Θ Ο */
'\0',
- '\xCE', '\xB1', '\xCE', '\xB5', '\xCE', '\xB9', '\xCE', '\xBF', '\xCF', '\x80', '\xCF', '\x83', '\xCF', '\x84', '\xCF', '\x89', /* αειοπστω */
+ '\xCE', '\xB2', ' ', '\xCE', '\xB8', ' ', '\xCE', '\xB4', ' ', '\xCE', '\xB6', ' ', '\xCE', '\xBB', ' ', '\xCE', '\xBE', /* β θ δ ζ λ ξ */
'\0',
- '\xCE', '\xB2', '\xCE', '\xB3', '\xCE', '\xB7', '\xCE', '\xBC', '\xCF', '\x81', '\xCF', '\x86', '\xCF', '\x87', '\xCF', '\x88', /* βγημρφχψ */
+ '\xCE', '\xB1', ' ', '\xCE', '\xB5', ' ', '\xCE', '\xB9', ' ', '\xCE', '\xBF', ' ', '\xCF', '\x80', ' ', '\xCF', '\x83', ' ', '\xCF', '\x84', ' ', '\xCF', '\x89', /* α ε ι ο π σ τ ω */
'\0',
- '\xD7', '\x91', '\xD7', '\x93', '\xD7', '\x94', '\xD7', '\x97', '\xD7', '\x9A', '\xD7', '\x9B', '\xD7', '\x9D', '\xD7', '\xA1', /* בדהחךכםס */
+ '\xCE', '\xB2', ' ', '\xCE', '\xB3', ' ', '\xCE', '\xB7', ' ', '\xCE', '\xBC', ' ', '\xCF', '\x81', ' ', '\xCF', '\x86', ' ', '\xCF', '\x87', ' ', '\xCF', '\x88', /* β γ η μ ρ φ χ ψ */
'\0',
- '\xD7', '\x91', '\xD7', '\x98', '\xD7', '\x9B', '\xD7', '\x9D', '\xD7', '\xA1', '\xD7', '\xA6', /* בטכםסצ */
+ '\xD7', '\x91', ' ', '\xD7', '\x93', ' ', '\xD7', '\x94', ' ', '\xD7', '\x97', ' ', '\xD7', '\x9A', ' ', '\xD7', '\x9B', ' ', '\xD7', '\x9D', ' ', '\xD7', '\xA1', /* ב ד ה ח ך כ ם ס */
'\0',
- '\xD7', '\xA7', '\xD7', '\x9A', '\xD7', '\x9F', '\xD7', '\xA3', '\xD7', '\xA5', /* קךןףץ */
+ '\xD7', '\x91', ' ', '\xD7', '\x98', ' ', '\xD7', '\x9B', ' ', '\xD7', '\x9D', ' ', '\xD7', '\xA1', ' ', '\xD7', '\xA6', /* ב ט כ ם ס צ */
'\0',
- 'T', 'H', 'E', 'Z', 'O', 'C', 'Q', 'S', /* THEZOCQS */
+ '\xD7', '\xA7', ' ', '\xD7', '\x9A', ' ', '\xD7', '\x9F', ' ', '\xD7', '\xA3', ' ', '\xD7', '\xA5', /* ק ך ן ף ץ */
'\0',
- 'H', 'E', 'Z', 'L', 'O', 'C', 'U', 'S', /* HEZLOCUS */
+ '\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x91', ' ', '\xE1', '\x9E', '\x93', ' ', '\xE1', '\x9E', '\xA7', ' ', '\xE1', '\x9E', '\xA9', ' ', '\xE1', '\x9E', '\xB6', /* ខ ទ ន ឧ ឩ ា */
'\0',
- 'f', 'i', 'j', 'k', 'd', 'b', 'h', /* fijkdbh */
+ '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x80', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x82', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x90', /* ក្ក ក្ខ ក្គ ក្ថ */
'\0',
- 'x', 'z', 'r', 'o', 'e', 's', 'c', /* xzroesc */
+ '\xE1', '\x9E', '\x81', ' ', '\xE1', '\x9E', '\x83', ' ', '\xE1', '\x9E', '\x85', ' ', '\xE1', '\x9E', '\x8B', ' ', '\xE1', '\x9E', '\x94', ' ', '\xE1', '\x9E', '\x98', ' ', '\xE1', '\x9E', '\x99', ' ', '\xE1', '\x9E', '\xB2', /* ខ ឃ ច ឋ ប ម យ ឲ */
'\0',
- 'p', 'q', 'g', 'j', 'y', /* pqgjy */
+ '\xE1', '\x9E', '\x8F', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x9A', ' ', '\xE1', '\x9E', '\x9A', '\xE1', '\x9F', '\x80', ' ', '\xE1', '\x9E', '\xB2', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x99', ' ', '\xE1', '\x9E', '\xA2', '\xE1', '\x9E', '\xBF', /* ត្រ រៀ ឲ្យ អឿ */
'\0',
- '\xE0', '\xB0', '\x87', '\xE0', '\xB0', '\x8C', '\xE0', '\xB0', '\x99', '\xE0', '\xB0', '\x9E', '\xE0', '\xB0', '\xA3', '\xE0', '\xB0', '\xB1', '\xE0', '\xB1', '\xAF', /* ఇ ఌ ఙ ఞ ణ ఱ ౯ */
+ '\xE1', '\x9E', '\x93', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x8F', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x9A', '\xE1', '\x9F', '\x83', ' ', '\xE1', '\x9E', '\x84', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x81', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x99', ' ', '\xE1', '\x9E', '\x80', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x94', '\xE1', '\x9F', '\x80', ' ', '\xE1', '\x9E', '\x85', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x9A', '\xE1', '\x9F', '\x80', ' ', '\xE1', '\x9E', '\x93', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x8F', '\xE1', '\x9E', '\xBF', ' ', '\xE1', '\x9E', '\x9B', '\xE1', '\x9F', '\x92', '\xE1', '\x9E', '\x94', '\xE1', '\x9E', '\xBF', /* ន្ត្រៃ ង្ខ្យ ក្បៀ ច្រៀ ន្តឿ ល្បឿ */
'\0',
- '\xE0', '\xB0', '\x85', '\xE0', '\xB0', '\x95', '\xE0', '\xB0', '\x9A', '\xE0', '\xB0', '\xB0', '\xE0', '\xB0', '\xBD', '\xE0', '\xB1', '\xA8', '\xE0', '\xB1', '\xAC', /* అ క చ ర ఽ ౨ ౬ */
+ '\xE1', '\xA7', '\xA0', ' ', '\xE1', '\xA7', '\xA1', /* ᧠ ᧡ */
'\0',
- '\xE0', '\xB8', '\x9A', '\xE0', '\xB9', '\x80', '\xE0', '\xB9', '\x81', '\xE0', '\xB8', '\xAD', '\xE0', '\xB8', '\x81', '\xE0', '\xB8', '\xB2', /* บ เ แ อ ก า */
+ '\xE1', '\xA7', '\xB6', ' ', '\xE1', '\xA7', '\xB9', /* ᧶ ᧹ */
'\0',
- '\xE0', '\xB8', '\x9A', '\xE0', '\xB8', '\x9B', '\xE0', '\xB8', '\xA9', '\xE0', '\xB8', '\xAF', '\xE0', '\xB8', '\xAD', '\xE0', '\xB8', '\xA2', '\xE0', '\xB8', '\xAE', /* บ ป ษ ฯ อ ย ฮ */
+ '\xE0', '\xBA', '\xB2', ' ', '\xE0', '\xBA', '\x94', ' ', '\xE0', '\xBA', '\xAD', ' ', '\xE0', '\xBA', '\xA1', ' ', '\xE0', '\xBA', '\xA5', ' ', '\xE0', '\xBA', '\xA7', ' ', '\xE0', '\xBA', '\xA3', ' ', '\xE0', '\xBA', '\x87', /* າ ດ ອ ມ ລ ວ ຣ ງ */
'\0',
- '\xE0', '\xB8', '\x9B', '\xE0', '\xB8', '\x9D', '\xE0', '\xB8', '\x9F', /* ป ฝ ฟ */
+ '\xE0', '\xBA', '\xB2', ' ', '\xE0', '\xBA', '\xAD', ' ', '\xE0', '\xBA', '\x9A', ' ', '\xE0', '\xBA', '\x8D', ' ', '\xE0', '\xBA', '\xA3', ' ', '\xE0', '\xBA', '\xAE', ' ', '\xE0', '\xBA', '\xA7', ' ', '\xE0', '\xBA', '\xA2', /* າ ອ ບ ຍ ຣ ຮ ວ ຢ */
'\0',
- '\xE0', '\xB9', '\x82', '\xE0', '\xB9', '\x83', '\xE0', '\xB9', '\x84', /* โ ใ ไ */
+ '\xE0', '\xBA', '\x9B', ' ', '\xE0', '\xBA', '\xA2', ' ', '\xE0', '\xBA', '\x9F', ' ', '\xE0', '\xBA', '\x9D', /* ປ ຢ ຟ ຝ */
'\0',
- '\xE0', '\xB8', '\x8E', '\xE0', '\xB8', '\x8F', '\xE0', '\xB8', '\xA4', '\xE0', '\xB8', '\xA6', /* ฎ ฏ ฤ ฦ */
+ '\xE0', '\xBB', '\x82', ' ', '\xE0', '\xBB', '\x84', ' ', '\xE0', '\xBB', '\x83', /* ໂ ໄ ໃ */
'\0',
- '\xE0', '\xB8', '\x8D', '\xE0', '\xB8', '\x90', /* ญ ฐ */
+ '\xE0', '\xBA', '\x87', ' ', '\xE0', '\xBA', '\x8A', ' ', '\xE0', '\xBA', '\x96', ' ', '\xE0', '\xBA', '\xBD', ' ', '\xE0', '\xBB', '\x86', ' ', '\xE0', '\xBA', '\xAF', /* ງ ຊ ຖ ຽ ໆ ຯ */
'\0',
- '\xE0', '\xB9', '\x90', '\xE0', '\xB9', '\x91', '\xE0', '\xB9', '\x93', /* ๐ ๑ ๓ */
+ 'T', ' ', 'H', ' ', 'E', ' ', 'Z', ' ', 'O', ' ', 'C', ' ', 'Q', ' ', 'S', /* T H E Z O C Q S */
+ '\0',
+ 'H', ' ', 'E', ' ', 'Z', ' ', 'L', ' ', 'O', ' ', 'C', ' ', 'U', ' ', 'S', /* H E Z L O C U S */
+ '\0',
+ 'f', ' ', 'i', ' ', 'j', ' ', 'k', ' ', 'd', ' ', 'b', ' ', 'h', /* f i j k d b h */
+ '\0',
+ 'x', ' ', 'z', ' ', 'r', ' ', 'o', ' ', 'e', ' ', 's', ' ', 'c', /* x z r o e s c */
+ '\0',
+ 'p', ' ', 'q', ' ', 'g', ' ', 'j', ' ', 'y', /* p q g j y */
+ '\0',
+ '\xE2', '\x82', '\x80', ' ', '\xE2', '\x82', '\x83', ' ', '\xE2', '\x82', '\x85', ' ', '\xE2', '\x82', '\x87', ' ', '\xE2', '\x82', '\x88', /* ₀ ₃ ₅ ₇ ₈ */
+ '\0',
+ '\xE2', '\x82', '\x80', ' ', '\xE2', '\x82', '\x81', ' ', '\xE2', '\x82', '\x82', ' ', '\xE2', '\x82', '\x83', ' ', '\xE2', '\x82', '\x88', /* ₀ ₁ ₂ ₃ ₈ */
+ '\0',
+ '\xE1', '\xB5', '\xA2', ' ', '\xE2', '\xB1', '\xBC', ' ', '\xE2', '\x82', '\x95', ' ', '\xE2', '\x82', '\x96', ' ', '\xE2', '\x82', '\x97', /* ᵢ ⱼ ₕ ₖ ₗ */
+ '\0',
+ '\xE2', '\x82', '\x90', ' ', '\xE2', '\x82', '\x91', ' ', '\xE2', '\x82', '\x92', ' ', '\xE2', '\x82', '\x93', ' ', '\xE2', '\x82', '\x99', ' ', '\xE2', '\x82', '\x9B', ' ', '\xE1', '\xB5', '\xA5', ' ', '\xE1', '\xB5', '\xA4', ' ', '\xE1', '\xB5', '\xA3', /* ₐ ₑ ₒ ₓ ₙ ₛ ᵥ ᵤ ᵣ */
+ '\0',
+ '\xE1', '\xB5', '\xA6', ' ', '\xE1', '\xB5', '\xA7', ' ', '\xE1', '\xB5', '\xA8', ' ', '\xE1', '\xB5', '\xA9', ' ', '\xE2', '\x82', '\x9A', /* ᵦ ᵧ ᵨ ᵩ ₚ */
+ '\0',
+ '\xE2', '\x81', '\xB0', ' ', '\xC2', '\xB3', ' ', '\xE2', '\x81', '\xB5', ' ', '\xE2', '\x81', '\xB7', ' ', '\xE1', '\xB5', '\x80', ' ', '\xE1', '\xB4', '\xB4', ' ', '\xE1', '\xB4', '\xB1', ' ', '\xE1', '\xB4', '\xBC', /* ⁰ ³ ⁵ ⁷ ᵀ ᴴ ᴱ ᴼ */
+ '\0',
+ '\xE2', '\x81', '\xB0', ' ', '\xC2', '\xB9', ' ', '\xC2', '\xB2', ' ', '\xC2', '\xB3', ' ', '\xE1', '\xB4', '\xB1', ' ', '\xE1', '\xB4', '\xB8', ' ', '\xE1', '\xB4', '\xBC', ' ', '\xE1', '\xB5', '\x81', /* ⁰ ¹ ² ³ ᴱ ᴸ ᴼ ᵁ */
+ '\0',
+ '\xE1', '\xB5', '\x87', ' ', '\xE1', '\xB5', '\x88', ' ', '\xE1', '\xB5', '\x8F', ' ', '\xCA', '\xB0', ' ', '\xCA', '\xB2', ' ', '\xE1', '\xB6', '\xA0', ' ', '\xE2', '\x81', '\xB1', /* ᵇ ᵈ ᵏ ʰ ʲ ᶠ ⁱ */
+ '\0',
+ '\xE1', '\xB5', '\x89', ' ', '\xE1', '\xB5', '\x92', ' ', '\xCA', '\xB3', ' ', '\xCB', '\xA2', ' ', '\xCB', '\xA3', ' ', '\xE1', '\xB6', '\x9C', ' ', '\xE1', '\xB6', '\xBB', /* ᵉ ᵒ ʳ ˢ ˣ ᶜ ᶻ */
+ '\0',
+ '\xE1', '\xB5', '\x96', ' ', '\xCA', '\xB8', ' ', '\xE1', '\xB5', '\x8D', /* ᵖ ʸ ᵍ */
+ '\0',
+ '\xE1', '\x80', '\x81', ' ', '\xE1', '\x80', '\x82', ' ', '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\xA5', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* ခ ဂ င ဒ ဝ ၥ ၊ ။ */
+ '\0',
+ '\xE1', '\x80', '\x84', ' ', '\xE1', '\x80', '\x8E', ' ', '\xE1', '\x80', '\x92', ' ', '\xE1', '\x80', '\x95', ' ', '\xE1', '\x80', '\x97', ' ', '\xE1', '\x80', '\x9D', ' ', '\xE1', '\x81', '\x8A', ' ', '\xE1', '\x81', '\x8B', /* င ဎ ဒ ပ ဗ ဝ ၊ ။ */
+ '\0',
+ '\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xBC', ' ', '\xE1', '\x81', '\x8D', ' ', '\xE1', '\x81', '\x8F', ' ', '\xE1', '\x81', '\x86', ' ', '\xE1', '\x80', '\xAB', ' ', '\xE1', '\x80', '\xAD', /* ဩ ြ ၍ ၏ ၆ ါ ိ */
+ '\0',
+ '\xE1', '\x80', '\x89', ' ', '\xE1', '\x80', '\x8A', ' ', '\xE1', '\x80', '\xA5', ' ', '\xE1', '\x80', '\xA9', ' ', '\xE1', '\x80', '\xA8', ' ', '\xE1', '\x81', '\x82', ' ', '\xE1', '\x81', '\x85', ' ', '\xE1', '\x81', '\x89', /* ဉ ည ဥ ဩ ဨ ၂ ၅ ၉ */
+ '\0',
+ '\xE0', '\xB0', '\x87', ' ', '\xE0', '\xB0', '\x8C', ' ', '\xE0', '\xB0', '\x99', ' ', '\xE0', '\xB0', '\x9E', ' ', '\xE0', '\xB0', '\xA3', ' ', '\xE0', '\xB0', '\xB1', ' ', '\xE0', '\xB1', '\xAF', /* ఇ ఌ ఙ ఞ ణ ఱ ౯ */
+ '\0',
+ '\xE0', '\xB0', '\x85', ' ', '\xE0', '\xB0', '\x95', ' ', '\xE0', '\xB0', '\x9A', ' ', '\xE0', '\xB0', '\xB0', ' ', '\xE0', '\xB0', '\xBD', ' ', '\xE0', '\xB1', '\xA8', ' ', '\xE0', '\xB1', '\xAC', /* అ క చ ర ఽ ౨ ౬ */
+ '\0',
+ '\xE0', '\xB8', '\x9A', ' ', '\xE0', '\xB9', '\x80', ' ', '\xE0', '\xB9', '\x81', ' ', '\xE0', '\xB8', '\xAD', ' ', '\xE0', '\xB8', '\x81', ' ', '\xE0', '\xB8', '\xB2', /* บ เ แ อ ก า */
+ '\0',
+ '\xE0', '\xB8', '\x9A', ' ', '\xE0', '\xB8', '\x9B', ' ', '\xE0', '\xB8', '\xA9', ' ', '\xE0', '\xB8', '\xAF', ' ', '\xE0', '\xB8', '\xAD', ' ', '\xE0', '\xB8', '\xA2', ' ', '\xE0', '\xB8', '\xAE', /* บ ป ษ ฯ อ ย ฮ */
+ '\0',
+ '\xE0', '\xB8', '\x9B', ' ', '\xE0', '\xB8', '\x9D', ' ', '\xE0', '\xB8', '\x9F', /* ป ฝ ฟ */
+ '\0',
+ '\xE0', '\xB9', '\x82', ' ', '\xE0', '\xB9', '\x83', ' ', '\xE0', '\xB9', '\x84', /* โ ใ ไ */
+ '\0',
+ '\xE0', '\xB8', '\x8E', ' ', '\xE0', '\xB8', '\x8F', ' ', '\xE0', '\xB8', '\xA4', ' ', '\xE0', '\xB8', '\xA6', /* ฎ ฏ ฤ ฦ */
+ '\0',
+ '\xE0', '\xB8', '\x8D', ' ', '\xE0', '\xB8', '\x90', /* ญ ฐ */
+ '\0',
+ '\xE0', '\xB9', '\x90', ' ', '\xE0', '\xB9', '\x91', ' ', '\xE0', '\xB9', '\x93', /* ๐ ๑ ๓ */
#ifdef AF_CONFIG_OPTION_CJK
'\0',
- '\xE4', '\xBB', '\x96', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\x9C', '\xB0', /* 他们你來們到和地 */
- '\xE5', '\xAF', '\xB9', '\xE5', '\xB0', '\x8D', '\xE5', '\xB0', '\xB1', '\xE5', '\xB8', '\xAD', '\xE6', '\x88', '\x91', '\xE6', '\x97', '\xB6', '\xE6', '\x99', '\x82', '\xE6', '\x9C', '\x83', /* 对對就席我时時會 */
- '\xE6', '\x9D', '\xA5', '\xE7', '\x82', '\xBA', '\xE8', '\x83', '\xBD', '\xE8', '\x88', '\xB0', '\xE8', '\xAA', '\xAA', '\xE8', '\xAF', '\xB4', '\xE8', '\xBF', '\x99', '\xE9', '\x80', '\x99', /* 来為能舰說说这這 */
- '\xE9', '\xBD', '\x8A', '|', /* 齊 | */
- '\xE5', '\x86', '\x9B', '\xE5', '\x90', '\x8C', '\xE5', '\xB7', '\xB2', '\xE6', '\x84', '\xBF', '\xE6', '\x97', '\xA2', '\xE6', '\x98', '\x9F', '\xE6', '\x98', '\xAF', '\xE6', '\x99', '\xAF', /* 军同已愿既星是景 */
- '\xE6', '\xB0', '\x91', '\xE7', '\x85', '\xA7', '\xE7', '\x8E', '\xB0', '\xE7', '\x8F', '\xBE', '\xE7', '\x90', '\x86', '\xE7', '\x94', '\xA8', '\xE7', '\xBD', '\xAE', '\xE8', '\xA6', '\x81', /* 民照现現理用置要 */
- '\xE8', '\xBB', '\x8D', '\xE9', '\x82', '\xA3', '\xE9', '\x85', '\x8D', '\xE9', '\x87', '\x8C', '\xE9', '\x96', '\x8B', '\xE9', '\x9B', '\xB7', '\xE9', '\x9C', '\xB2', '\xE9', '\x9D', '\xA2', /* 軍那配里開雷露面 */
- '\xE9', '\xA1', '\xBE', /* 顾 */
- '\0',
- '\xE4', '\xB8', '\xAA', '\xE4', '\xB8', '\xBA', '\xE4', '\xBA', '\xBA', '\xE4', '\xBB', '\x96', '\xE4', '\xBB', '\xA5', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', /* 个为人他以们你來 */
- '\xE5', '\x80', '\x8B', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\xA4', '\xA7', '\xE5', '\xAF', '\xB9', '\xE5', '\xB0', '\x8D', '\xE5', '\xB0', '\xB1', /* 個們到和大对對就 */
- '\xE6', '\x88', '\x91', '\xE6', '\x97', '\xB6', '\xE6', '\x99', '\x82', '\xE6', '\x9C', '\x89', '\xE6', '\x9D', '\xA5', '\xE7', '\x82', '\xBA', '\xE8', '\xA6', '\x81', '\xE8', '\xAA', '\xAA', /* 我时時有来為要說 */
- '\xE8', '\xAF', '\xB4', '|', /* 说 | */
- '\xE4', '\xB8', '\xBB', '\xE4', '\xBA', '\x9B', '\xE5', '\x9B', '\xA0', '\xE5', '\xAE', '\x83', '\xE6', '\x83', '\xB3', '\xE6', '\x84', '\x8F', '\xE7', '\x90', '\x86', '\xE7', '\x94', '\x9F', /* 主些因它想意理生 */
- '\xE7', '\x95', '\xB6', '\xE7', '\x9C', '\x8B', '\xE7', '\x9D', '\x80', '\xE7', '\xBD', '\xAE', '\xE8', '\x80', '\x85', '\xE8', '\x87', '\xAA', '\xE8', '\x91', '\x97', '\xE8', '\xA3', '\xA1', /* 當看着置者自著裡 */
- '\xE8', '\xBF', '\x87', '\xE8', '\xBF', '\x98', '\xE8', '\xBF', '\x9B', '\xE9', '\x80', '\xB2', '\xE9', '\x81', '\x8E', '\xE9', '\x81', '\x93', '\xE9', '\x82', '\x84', '\xE9', '\x87', '\x8C', /* 过还进進過道還里 */
- '\xE9', '\x9D', '\xA2', /* 面 */
+ '\xE4', '\xBB', '\x96', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\x9C', '\xB0', /* 他 们 你 來 們 到 和 地 */
+ ' ', '\xE5', '\xAF', '\xB9', ' ', '\xE5', '\xB0', '\x8D', ' ', '\xE5', '\xB0', '\xB1', ' ', '\xE5', '\xB8', '\xAD', ' ', '\xE6', '\x88', '\x91', ' ', '\xE6', '\x97', '\xB6', ' ', '\xE6', '\x99', '\x82', ' ', '\xE6', '\x9C', '\x83', /* 对 對 就 席 我 时 時 會 */
+ ' ', '\xE6', '\x9D', '\xA5', ' ', '\xE7', '\x82', '\xBA', ' ', '\xE8', '\x83', '\xBD', ' ', '\xE8', '\x88', '\xB0', ' ', '\xE8', '\xAA', '\xAA', ' ', '\xE8', '\xAF', '\xB4', ' ', '\xE8', '\xBF', '\x99', ' ', '\xE9', '\x80', '\x99', /* 来 為 能 舰 說 说 这 這 */
+ ' ', '\xE9', '\xBD', '\x8A', ' ', '|', /* 齊 | */
+ ' ', '\xE5', '\x86', '\x9B', ' ', '\xE5', '\x90', '\x8C', ' ', '\xE5', '\xB7', '\xB2', ' ', '\xE6', '\x84', '\xBF', ' ', '\xE6', '\x97', '\xA2', ' ', '\xE6', '\x98', '\x9F', ' ', '\xE6', '\x98', '\xAF', ' ', '\xE6', '\x99', '\xAF', /* 军 同 已 愿 既 星 是 景 */
+ ' ', '\xE6', '\xB0', '\x91', ' ', '\xE7', '\x85', '\xA7', ' ', '\xE7', '\x8E', '\xB0', ' ', '\xE7', '\x8F', '\xBE', ' ', '\xE7', '\x90', '\x86', ' ', '\xE7', '\x94', '\xA8', ' ', '\xE7', '\xBD', '\xAE', ' ', '\xE8', '\xA6', '\x81', /* 民 照 现 現 理 用 置 要 */
+ ' ', '\xE8', '\xBB', '\x8D', ' ', '\xE9', '\x82', '\xA3', ' ', '\xE9', '\x85', '\x8D', ' ', '\xE9', '\x87', '\x8C', ' ', '\xE9', '\x96', '\x8B', ' ', '\xE9', '\x9B', '\xB7', ' ', '\xE9', '\x9C', '\xB2', ' ', '\xE9', '\x9D', '\xA2', /* 軍 那 配 里 開 雷 露 面 */
+ ' ', '\xE9', '\xA1', '\xBE', /* 顾 */
+ '\0',
+ '\xE4', '\xB8', '\xAA', ' ', '\xE4', '\xB8', '\xBA', ' ', '\xE4', '\xBA', '\xBA', ' ', '\xE4', '\xBB', '\x96', ' ', '\xE4', '\xBB', '\xA5', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', /* 个 为 人 他 以 们 你 來 */
+ ' ', '\xE5', '\x80', '\x8B', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\xA4', '\xA7', ' ', '\xE5', '\xAF', '\xB9', ' ', '\xE5', '\xB0', '\x8D', ' ', '\xE5', '\xB0', '\xB1', /* 個 們 到 和 大 对 對 就 */
+ ' ', '\xE6', '\x88', '\x91', ' ', '\xE6', '\x97', '\xB6', ' ', '\xE6', '\x99', '\x82', ' ', '\xE6', '\x9C', '\x89', ' ', '\xE6', '\x9D', '\xA5', ' ', '\xE7', '\x82', '\xBA', ' ', '\xE8', '\xA6', '\x81', ' ', '\xE8', '\xAA', '\xAA', /* 我 时 時 有 来 為 要 說 */
+ ' ', '\xE8', '\xAF', '\xB4', ' ', '|', /* 说 | */
+ ' ', '\xE4', '\xB8', '\xBB', ' ', '\xE4', '\xBA', '\x9B', ' ', '\xE5', '\x9B', '\xA0', ' ', '\xE5', '\xAE', '\x83', ' ', '\xE6', '\x83', '\xB3', ' ', '\xE6', '\x84', '\x8F', ' ', '\xE7', '\x90', '\x86', ' ', '\xE7', '\x94', '\x9F', /* 主 些 因 它 想 意 理 生 */
+ ' ', '\xE7', '\x95', '\xB6', ' ', '\xE7', '\x9C', '\x8B', ' ', '\xE7', '\x9D', '\x80', ' ', '\xE7', '\xBD', '\xAE', ' ', '\xE8', '\x80', '\x85', ' ', '\xE8', '\x87', '\xAA', ' ', '\xE8', '\x91', '\x97', ' ', '\xE8', '\xA3', '\xA1', /* 當 看 着 置 者 自 著 裡 */
+ ' ', '\xE8', '\xBF', '\x87', ' ', '\xE8', '\xBF', '\x98', ' ', '\xE8', '\xBF', '\x9B', ' ', '\xE9', '\x80', '\xB2', ' ', '\xE9', '\x81', '\x8E', ' ', '\xE9', '\x81', '\x93', ' ', '\xE9', '\x82', '\x84', ' ', '\xE9', '\x87', '\x8C', /* 过 还 进 進 過 道 還 里 */
+ ' ', '\xE9', '\x9D', '\xA2', /* 面 */
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
'\0',
- '\xE4', '\xBA', '\x9B', '\xE4', '\xBB', '\xAC', '\xE4', '\xBD', '\xA0', '\xE4', '\xBE', '\x86', '\xE5', '\x80', '\x91', '\xE5', '\x88', '\xB0', '\xE5', '\x92', '\x8C', '\xE5', '\x9C', '\xB0', /* 些们你來們到和地 */
- '\xE5', '\xA5', '\xB9', '\xE5', '\xB0', '\x86', '\xE5', '\xB0', '\x87', '\xE5', '\xB0', '\xB1', '\xE5', '\xB9', '\xB4', '\xE5', '\xBE', '\x97', '\xE6', '\x83', '\x85', '\xE6', '\x9C', '\x80', /* 她将將就年得情最 */
- '\xE6', '\xA0', '\xB7', '\xE6', '\xA8', '\xA3', '\xE7', '\x90', '\x86', '\xE8', '\x83', '\xBD', '\xE8', '\xAA', '\xAA', '\xE8', '\xAF', '\xB4', '\xE8', '\xBF', '\x99', '\xE9', '\x80', '\x99', /* 样樣理能說说这這 */
- '\xE9', '\x80', '\x9A', '|', /* 通 | */
- '\xE5', '\x8D', '\xB3', '\xE5', '\x90', '\x97', '\xE5', '\x90', '\xA7', '\xE5', '\x90', '\xAC', '\xE5', '\x91', '\xA2', '\xE5', '\x93', '\x81', '\xE5', '\x93', '\x8D', '\xE5', '\x97', '\x8E', /* 即吗吧听呢品响嗎 */
- '\xE5', '\xB8', '\x88', '\xE5', '\xB8', '\xAB', '\xE6', '\x94', '\xB6', '\xE6', '\x96', '\xAD', '\xE6', '\x96', '\xB7', '\xE6', '\x98', '\x8E', '\xE7', '\x9C', '\xBC', '\xE9', '\x96', '\x93', /* 师師收断斷明眼間 */
- '\xE9', '\x97', '\xB4', '\xE9', '\x99', '\x85', '\xE9', '\x99', '\x88', '\xE9', '\x99', '\x90', '\xE9', '\x99', '\xA4', '\xE9', '\x99', '\xB3', '\xE9', '\x9A', '\x8F', '\xE9', '\x9A', '\x9B', /* 间际陈限除陳随際 */
- '\xE9', '\x9A', '\xA8', /* 隨 */
- '\0',
- '\xE4', '\xBA', '\x8B', '\xE5', '\x89', '\x8D', '\xE5', '\xAD', '\xB8', '\xE5', '\xB0', '\x86', '\xE5', '\xB0', '\x87', '\xE6', '\x83', '\x85', '\xE6', '\x83', '\xB3', '\xE6', '\x88', '\x96', /* 事前學将將情想或 */
- '\xE6', '\x94', '\xBF', '\xE6', '\x96', '\xAF', '\xE6', '\x96', '\xB0', '\xE6', '\xA0', '\xB7', '\xE6', '\xA8', '\xA3', '\xE6', '\xB0', '\x91', '\xE6', '\xB2', '\x92', '\xE6', '\xB2', '\xA1', /* 政斯新样樣民沒没 */
- '\xE7', '\x84', '\xB6', '\xE7', '\x89', '\xB9', '\xE7', '\x8E', '\xB0', '\xE7', '\x8F', '\xBE', '\xE7', '\x90', '\x83', '\xE7', '\xAC', '\xAC', '\xE7', '\xB6', '\x93', '\xE8', '\xB0', '\x81', /* 然特现現球第經谁 */
- '\xE8', '\xB5', '\xB7', '|', /* 起 | */
- '\xE4', '\xBE', '\x8B', '\xE5', '\x88', '\xA5', '\xE5', '\x88', '\xAB', '\xE5', '\x88', '\xB6', '\xE5', '\x8A', '\xA8', '\xE5', '\x8B', '\x95', '\xE5', '\x90', '\x97', '\xE5', '\x97', '\x8E', /* 例別别制动動吗嗎 */
- '\xE5', '\xA2', '\x9E', '\xE6', '\x8C', '\x87', '\xE6', '\x98', '\x8E', '\xE6', '\x9C', '\x9D', '\xE6', '\x9C', '\x9F', '\xE6', '\x9E', '\x84', '\xE7', '\x89', '\xA9', '\xE7', '\xA1', '\xAE', /* 增指明朝期构物确 */
- '\xE7', '\xA7', '\x8D', '\xE8', '\xAA', '\xBF', '\xE8', '\xB0', '\x83', '\xE8', '\xB2', '\xBB', '\xE8', '\xB4', '\xB9', '\xE9', '\x82', '\xA3', '\xE9', '\x83', '\xBD', '\xE9', '\x96', '\x93', /* 种調调費费那都間 */
- '\xE9', '\x97', '\xB4', /* 间 */
+ ' ', '\xE4', '\xBA', '\x9B', ' ', '\xE4', '\xBB', '\xAC', ' ', '\xE4', '\xBD', '\xA0', ' ', '\xE4', '\xBE', '\x86', ' ', '\xE5', '\x80', '\x91', ' ', '\xE5', '\x88', '\xB0', ' ', '\xE5', '\x92', '\x8C', ' ', '\xE5', '\x9C', '\xB0', /* 些 们 你 來 們 到 和 地 */
+ ' ', '\xE5', '\xA5', '\xB9', ' ', '\xE5', '\xB0', '\x86', ' ', '\xE5', '\xB0', '\x87', ' ', '\xE5', '\xB0', '\xB1', ' ', '\xE5', '\xB9', '\xB4', ' ', '\xE5', '\xBE', '\x97', ' ', '\xE6', '\x83', '\x85', ' ', '\xE6', '\x9C', '\x80', /* 她 将 將 就 年 得 情 最 */
+ ' ', '\xE6', '\xA0', '\xB7', ' ', '\xE6', '\xA8', '\xA3', ' ', '\xE7', '\x90', '\x86', ' ', '\xE8', '\x83', '\xBD', ' ', '\xE8', '\xAA', '\xAA', ' ', '\xE8', '\xAF', '\xB4', ' ', '\xE8', '\xBF', '\x99', ' ', '\xE9', '\x80', '\x99', /* 样 樣 理 能 說 说 这 這 */
+ ' ', '\xE9', '\x80', '\x9A', ' ', '|', /* 通 | */
+ ' ', '\xE5', '\x8D', '\xB3', ' ', '\xE5', '\x90', '\x97', ' ', '\xE5', '\x90', '\xA7', ' ', '\xE5', '\x90', '\xAC', ' ', '\xE5', '\x91', '\xA2', ' ', '\xE5', '\x93', '\x81', ' ', '\xE5', '\x93', '\x8D', ' ', '\xE5', '\x97', '\x8E', /* 即 吗 吧 听 呢 品 响 嗎 */
+ ' ', '\xE5', '\xB8', '\x88', ' ', '\xE5', '\xB8', '\xAB', ' ', '\xE6', '\x94', '\xB6', ' ', '\xE6', '\x96', '\xAD', ' ', '\xE6', '\x96', '\xB7', ' ', '\xE6', '\x98', '\x8E', ' ', '\xE7', '\x9C', '\xBC', ' ', '\xE9', '\x96', '\x93', /* 师 師 收 断 斷 明 眼 間 */
+ ' ', '\xE9', '\x97', '\xB4', ' ', '\xE9', '\x99', '\x85', ' ', '\xE9', '\x99', '\x88', ' ', '\xE9', '\x99', '\x90', ' ', '\xE9', '\x99', '\xA4', ' ', '\xE9', '\x99', '\xB3', ' ', '\xE9', '\x9A', '\x8F', ' ', '\xE9', '\x9A', '\x9B', /* 间 际 陈 限 除 陳 随 際 */
+ ' ', '\xE9', '\x9A', '\xA8', /* 隨 */
+ '\0',
+ '\xE4', '\xBA', '\x8B', ' ', '\xE5', '\x89', '\x8D', ' ', '\xE5', '\xAD', '\xB8', ' ', '\xE5', '\xB0', '\x86', ' ', '\xE5', '\xB0', '\x87', ' ', '\xE6', '\x83', '\x85', ' ', '\xE6', '\x83', '\xB3', ' ', '\xE6', '\x88', '\x96', /* 事 前 學 将 將 情 想 或 */
+ ' ', '\xE6', '\x94', '\xBF', ' ', '\xE6', '\x96', '\xAF', ' ', '\xE6', '\x96', '\xB0', ' ', '\xE6', '\xA0', '\xB7', ' ', '\xE6', '\xA8', '\xA3', ' ', '\xE6', '\xB0', '\x91', ' ', '\xE6', '\xB2', '\x92', ' ', '\xE6', '\xB2', '\xA1', /* 政 斯 新 样 樣 民 沒 没 */
+ ' ', '\xE7', '\x84', '\xB6', ' ', '\xE7', '\x89', '\xB9', ' ', '\xE7', '\x8E', '\xB0', ' ', '\xE7', '\x8F', '\xBE', ' ', '\xE7', '\x90', '\x83', ' ', '\xE7', '\xAC', '\xAC', ' ', '\xE7', '\xB6', '\x93', ' ', '\xE8', '\xB0', '\x81', /* 然 特 现 現 球 第 經 谁 */
+ ' ', '\xE8', '\xB5', '\xB7', ' ', '|', /* 起 | */
+ ' ', '\xE4', '\xBE', '\x8B', ' ', '\xE5', '\x88', '\xA5', ' ', '\xE5', '\x88', '\xAB', ' ', '\xE5', '\x88', '\xB6', ' ', '\xE5', '\x8A', '\xA8', ' ', '\xE5', '\x8B', '\x95', ' ', '\xE5', '\x90', '\x97', ' ', '\xE5', '\x97', '\x8E', /* 例 別 别 制 动 動 吗 嗎 */
+ ' ', '\xE5', '\xA2', '\x9E', ' ', '\xE6', '\x8C', '\x87', ' ', '\xE6', '\x98', '\x8E', ' ', '\xE6', '\x9C', '\x9D', ' ', '\xE6', '\x9C', '\x9F', ' ', '\xE6', '\x9E', '\x84', ' ', '\xE7', '\x89', '\xA9', ' ', '\xE7', '\xA1', '\xAE', /* 增 指 明 朝 期 构 物 确 */
+ ' ', '\xE7', '\xA7', '\x8D', ' ', '\xE8', '\xAA', '\xBF', ' ', '\xE8', '\xB0', '\x83', ' ', '\xE8', '\xB2', '\xBB', ' ', '\xE8', '\xB4', '\xB9', ' ', '\xE9', '\x82', '\xA3', ' ', '\xE9', '\x83', '\xBD', ' ', '\xE9', '\x96', '\x93', /* 种 調 调 費 费 那 都 間 */
+ ' ', '\xE9', '\x97', '\xB4', /* 间 */
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
#endif /* AF_CONFIG_OPTION_CJK */
'\0',
@@ -139,9 +193,10 @@
af_blue_stringsets[] =
{
/* */
- { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_ARABIC_JOIN, 0 },
- { AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_ARABIC_BOTTOM, 0 },
+ { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 },
{ AF_BLUE_STRING_CYRILLIC_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
@@ -170,6 +225,24 @@
{ AF_BLUE_STRING_HEBREW_BOTTOM, 0 },
{ AF_BLUE_STRING_HEBREW_DESCENDER, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP },
+ { AF_BLUE_STRING_KHMER_BOTTOM, 0 },
+ { AF_BLUE_STRING_KHMER_DESCENDER, 0 },
+ { AF_BLUE_STRING_KHMER_LARGE_DESCENDER, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_LAO_BOTTOM, 0 },
+ { AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_LAO_DESCENDER, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 },
{ AF_BLUE_STRING_LATIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
@@ -178,6 +251,28 @@
{ AF_BLUE_STRING_LATIN_SMALL, 0 },
{ AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 },
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 },
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 },
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 },
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_MYANMAR_BOTTOM, 0 },
+ { AF_BLUE_STRING_MYANMAR_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat
index fd5684e..5ffb852 100644
--- a/src/autofit/afblue.dat
+++ b/src/autofit/afblue.dat
@@ -20,9 +20,8 @@
// labels separated by whitespace and followed by a colon (everything in a
// single line); the first label gives the name of the enumeration template,
// the second the name of the array template, and the third the name of the
-// `maximum' template, holding the size of the largest array element. The
-// script then fills the corresponding templates (indicated by `@'
-// characters around the name).
+// `maximum' template. The script then fills the corresponding templates
+// (indicated by `@' characters around the name).
//
// A section contains one or more data records. Each data record consists
// of two or more lines. The first line holds the enumeration name, and the
@@ -30,15 +29,20 @@
//
// There are two possible representations for array data.
//
-// - A string of characters in UTF-8 encoding enclosed in double quotes,
-// using C syntax. There can be only one string per line, thus the
-// starting and ending double quote must be the first and last character
-// in the line, respectively, ignoring whitespace before and after the
-// string. Space characters within the string are ignored too. If there
-// are multiple strings (in multiple lines), they are concatenated to a
-// single string. In the output, a string gets represented as a series of
-// singles bytes, followed by a zero byte. The enumeration values simply
-// hold byte offsets to the start of the corresponding strings.
+// - A string of characters or character clusters (for example, representing
+// Aksharas, Devanagari syllables) in UTF-8 encoding enclosed in double
+// quotes, using C syntax, where the elements are separated by spaces.
+// There can be only one string per line, thus the starting and ending
+// double quote must be the first and last character in the line,
+// respectively, ignoring whitespace before and after the string. If
+// there are multiple strings (in multiple lines), they are concatenated
+// to a single string. In the output, a string gets represented as a
+// series of singles bytes, followed by a zero byte. The enumeration
+// values simply hold byte offsets to the start of the corresponding
+// strings.
+//
+// For strings, the `maximum' template holds the maximum number of
+// non-space characters in all strings.
//
// - Data blocks enclosed in balanced braces, which get copied verbatim and
// which can span multiple lines. The opening brace of a block must be
@@ -47,6 +51,9 @@
// character after each block and counts the number of blocks to set the
// enumeration values.
//
+// For data blocks, the `maximum' template holds the maximum number of
+// array elements.
+//
// A section can contain either strings only or data blocks only.
//
// A comment line starts with `//'; it gets removed. A preprocessor
@@ -69,20 +76,25 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
AF_BLUE_STRING_ARABIC_TOP
"ا إ ل ك ط ظ"
- AF_BLUE_STRING_ARABIC_JOIN
+ AF_BLUE_STRING_ARABIC_BOTTOM
"ت ث ط ظ ك"
+ // We don't necessarily have access to medial forms via Unicode in case
+ // Arabic presentational forms are missing. The only character that is
+ // guaranteed to have the same vertical position with joining (this is,
+ // non-isolated) forms is U+0640, ARABIC TATWEEL, which must join both
+ // round and flat curves.
+ AF_BLUE_STRING_ARABIC_JOIN
+ "ـ"
AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP
- "БВЕПЗОСЭ"
+ "Б В Е П З О С Э"
AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM
- "БВЕШЗОСЭ"
+ "Б В Е Ш З О С Э"
AF_BLUE_STRING_CYRILLIC_SMALL
- "хпншезос"
+ "х п н ш е з о с"
AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER
- "руф"
+ "р у ф"
- // we separate the letters with spaces to avoid ligatures;
- // this is just for convenience to simplify reading
AF_BLUE_STRING_DEVANAGARI_BASE
"क म अ आ थ ध भ श"
AF_BLUE_STRING_DEVANAGARI_TOP
@@ -96,36 +108,95 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
"ु ृ"
AF_BLUE_STRING_GREEK_CAPITAL_TOP
- "ΓΒΕΖΘΟΩ"
+ "Γ Β Ε Ζ Θ Ο Ω"
AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM
- "ΒΔΖΞΘΟ"
+ "Β Δ Ζ Ξ Θ Ο"
AF_BLUE_STRING_GREEK_SMALL_BETA_TOP
- "βθδζλξ"
+ "β θ δ ζ λ ξ"
AF_BLUE_STRING_GREEK_SMALL
- "αειοπστω"
+ "α ε ι ο π σ τ ω"
AF_BLUE_STRING_GREEK_SMALL_DESCENDER
- "βγημρφχψ"
+ "β γ η μ ρ φ χ ψ"
AF_BLUE_STRING_HEBREW_TOP
- "בדהחךכםס"
+ "ב ד ה ח ך כ ם ס"
AF_BLUE_STRING_HEBREW_BOTTOM
- "בטכםסצ"
+ "ב ט כ ם ס צ"
AF_BLUE_STRING_HEBREW_DESCENDER
- "קךןףץ"
+ "ק ך ן ף ץ"
+
+ AF_BLUE_STRING_KHMER_TOP
+ "ខ ទ ន ឧ ឩ ា"
+ AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP
+ "ក្ក ក្ខ ក្គ ក្ថ"
+ AF_BLUE_STRING_KHMER_BOTTOM
+ "ខ ឃ ច ឋ ប ម យ ឲ"
+ AF_BLUE_STRING_KHMER_DESCENDER
+ "ត្រ រៀ ឲ្យ អឿ"
+ AF_BLUE_STRING_KHMER_LARGE_DESCENDER
+ "ន្ត្រៃ ង្ខ្យ ក្បៀ ច្រៀ ន្តឿ ល្បឿ"
+
+ AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP
+ "᧠ ᧡"
+ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM
+ "᧶ ᧹"
+
+ AF_BLUE_STRING_LAO_TOP
+ "າ ດ ອ ມ ລ ວ ຣ ງ"
+ AF_BLUE_STRING_LAO_BOTTOM
+ "າ ອ ບ ຍ ຣ ຮ ວ ຢ"
+ AF_BLUE_STRING_LAO_ASCENDER
+ "ປ ຢ ຟ ຝ"
+ AF_BLUE_STRING_LAO_LARGE_ASCENDER
+ "ໂ ໄ ໃ"
+ AF_BLUE_STRING_LAO_DESCENDER
+ "ງ ຊ ຖ ຽ ໆ ຯ"
AF_BLUE_STRING_LATIN_CAPITAL_TOP
- "THEZOCQS"
+ "T H E Z O C Q S"
AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM
- "HEZLOCUS"
+ "H E Z L O C U S"
AF_BLUE_STRING_LATIN_SMALL_F_TOP
- "fijkdbh"
+ "f i j k d b h"
AF_BLUE_STRING_LATIN_SMALL
- "xzroesc"
+ "x z r o e s c"
AF_BLUE_STRING_LATIN_SMALL_DESCENDER
- "pqgjy"
+ "p q g j y"
+
+ // we assume that both the subscript and superscript ranges
+ // don't contain oldstyle digits (actually, most fonts probably
+ // have digits only in those ranges)
+ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP
+ "₀ ₃ ₅ ₇ ₈"
+ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM
+ "₀ ₁ ₂ ₃ ₈"
+ AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP
+ "ᵢ ⱼ ₕ ₖ ₗ"
+ AF_BLUE_STRING_LATIN_SUBS_SMALL
+ "ₐ ₑ ₒ ₓ ₙ ₛ ᵥ ᵤ ᵣ"
+ AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER
+ "ᵦ ᵧ ᵨ ᵩ ₚ"
+
+ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP
+ "⁰ ³ ⁵ ⁷ ᵀ ᴴ ᴱ ᴼ"
+ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM
+ "⁰ ¹ ² ³ ᴱ ᴸ ᴼ ᵁ"
+ AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP
+ "ᵇ ᵈ ᵏ ʰ ʲ ᶠ ⁱ"
+ AF_BLUE_STRING_LATIN_SUPS_SMALL
+ "ᵉ ᵒ ʳ ˢ ˣ ᶜ ᶻ"
+ AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER
+ "ᵖ ʸ ᵍ"
+
+ AF_BLUE_STRING_MYANMAR_TOP
+ "ခ ဂ င ဒ ဝ ၥ ၊ ။"
+ AF_BLUE_STRING_MYANMAR_BOTTOM
+ "င ဎ ဒ ပ ဗ ဝ ၊ ။"
+ AF_BLUE_STRING_MYANMAR_ASCENDER
+ "ဩ ြ ၍ ၏ ၆ ါ ိ"
+ AF_BLUE_STRING_MYANMAR_DESCENDER
+ "ဉ ည ဥ ဩ ဨ ၂ ၅ ၉"
- // we separate the letters with spaces to avoid ligatures;
- // this is just for convenience to simplify reading
AF_BLUE_STRING_TELUGU_TOP
"ఇ ఌ ఙ ఞ ణ ఱ ౯"
AF_BLUE_STRING_TELUGU_BOTTOM
@@ -150,44 +221,44 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRING_CJK_TOP
- "他们你來們到和地"
- "对對就席我时時會"
- "来為能舰說说这這"
- "齊 |"
- "军同已愿既星是景"
- "民照现現理用置要"
- "軍那配里開雷露面"
- "顾"
+ "他 们 你 來 們 到 和 地"
+ " 对 對 就 席 我 时 時 會"
+ " 来 為 能 舰 說 说 这 這"
+ " 齊 |"
+ " 军 同 已 愿 既 星 是 景"
+ " 民 照 现 現 理 用 置 要"
+ " 軍 那 配 里 開 雷 露 面"
+ " 顾"
AF_BLUE_STRING_CJK_BOTTOM
- "个为人他以们你來"
- "個們到和大对對就"
- "我时時有来為要說"
- "说 |"
- "主些因它想意理生"
- "當看着置者自著裡"
- "过还进進過道還里"
- "面"
+ "个 为 人 他 以 们 你 來"
+ " 個 們 到 和 大 对 對 就"
+ " 我 时 時 有 来 為 要 說"
+ " 说 |"
+ " 主 些 因 它 想 意 理 生"
+ " 當 看 着 置 者 自 著 裡"
+ " 过 还 进 進 過 道 還 里"
+ " 面"
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
AF_BLUE_STRING_CJK_LEFT
- "些们你來們到和地"
- "她将將就年得情最"
- "样樣理能說说这這"
- "通 |"
- "即吗吧听呢品响嗎"
- "师師收断斷明眼間"
- "间际陈限除陳随際"
- "隨"
+ " 些 们 你 來 們 到 和 地"
+ " 她 将 將 就 年 得 情 最"
+ " 样 樣 理 能 說 说 这 這"
+ " 通 |"
+ " 即 吗 吧 听 呢 品 响 嗎"
+ " 师 師 收 断 斷 明 眼 間"
+ " 间 际 陈 限 除 陳 随 際"
+ " 隨"
AF_BLUE_STRING_CJK_RIGHT
- "事前學将將情想或"
- "政斯新样樣民沒没"
- "然特现現球第經谁"
- "起 |"
- "例別别制动動吗嗎"
- "增指明朝期构物确"
- "种調调費费那都間"
- "间"
+ "事 前 學 将 將 情 想 或"
+ " 政 斯 新 样 樣 民 沒 没"
+ " 然 特 现 現 球 第 經 谁"
+ " 起 |"
+ " 例 別 别 制 动 動 吗 嗎"
+ " 增 指 明 朝 期 构 物 确"
+ " 种 調 调 費 费 那 都 間"
+ " 间"
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
@@ -219,6 +290,14 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
// respectively. Only horizontal blue zones (i.e., adjusting vertical
// coordinate values) are supported.
//
+// Some scripts like Khmer need character composition to get all necessary
+// blue zones, since Unicode only provides an abstract data model that
+// doesn't represent all possible glyph shapes. For such character
+// clusters, the HarfBuzz library is used to convert them into the
+// corresponding glyphs. The largest glyph element (where `largest' can be
+// either `largest ascender' or `largest descender') then defines the
+// corresponding flat or round extremum.
+//
// For the latin auto-hinter, the overshoot should be larger than the
// reference for top zones, and vice versa for bottom zones.
//
@@ -229,6 +308,21 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
//
// If not set, take the minimum values.
//
+// Mutually exclusive with `LATIN_SUB_TOP'.
+//
+// LATIN_SUB_TOP
+// For all glyphs of a character cluster, compute the maximum flat
+// and round coordinate values of each component, then take the
+// smallest of the maximum values. The idea is to get the top of
+// subscript glyphs, as used in Khmer, for example. Note that
+// this mechanism doesn't work for ordinary ligatures.
+//
+// This flags indicates a secondary blue zone: It gets removed if
+// there is a non-LATIN_SUB_TOP blue zone at the same coordinate
+// value (after scaling).
+//
+// Mutually exclusive with `LATIN_TOP'.
+//
// LATIN_NEUTRAL
// Ignore round extrema and define the blue zone with flat values only.
// Both top and bottom of contours can match. This is useful for
@@ -264,11 +358,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
//
// Characters in a blue string are *not* automatically classified. Instead,
// first come the characters used for the overshoot value, then the
-// character `|', then the characters used for the reference value. The
-// blue zone is then set up by the mean values of all reference values and
-// all overshoot values, respectively. Both horizontal and vertical blue
-// zones (i.e., adjusting vertical and horizontal coordinate values,
-// respectively) are supported.
+// character `|', then the characters used for the reference value
+// (everything separated by space characters). The blue zone is then set up
+// by the mean values of all reference values and all overshoot values,
+// respectively. Both horizontal and vertical blue zones (i.e., adjusting
+// vertical and horizontal coordinate values, respectively) are supported.
//
// For the cjk auto-hinter, the overshoot should be smaller than the
// reference for top zones, and vice versa for bottom zones.
@@ -289,9 +383,10 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
AF_BLUE_STRINGSET_ARAB
- { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_ARABIC_JOIN, 0 }
- { AF_BLUE_STRING_MAX, 0 }
+ { AF_BLUE_STRING_ARABIC_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_ARABIC_BOTTOM, 0 }
+ { AF_BLUE_STRING_ARABIC_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }
+ { AF_BLUE_STRING_MAX, 0 }
AF_BLUE_STRINGSET_CYRL
{ AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
@@ -329,6 +424,30 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_HEBREW_DESCENDER, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_KHMR
+ { AF_BLUE_STRING_KHMER_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP, AF_BLUE_PROPERTY_LATIN_SUB_TOP }
+ { AF_BLUE_STRING_KHMER_BOTTOM, 0 }
+ { AF_BLUE_STRING_KHMER_DESCENDER, 0 }
+ { AF_BLUE_STRING_KHMER_LARGE_DESCENDER, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
+ AF_BLUE_STRINGSET_KHMS
+ { AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
+ AF_BLUE_STRINGSET_LAO
+ { AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_LAO_BOTTOM, 0 }
+ { AF_BLUE_STRING_LAO_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_LAO_LARGE_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_LAO_DESCENDER, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_LATN
{ AF_BLUE_STRING_LATIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
{ AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }
@@ -339,6 +458,34 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_LATB
+ { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM, 0 }
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL, 0 }
+ { AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
+ AF_BLUE_STRINGSET_LATP
+ { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM, 0 }
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL, 0 }
+ { AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
+ AF_BLUE_STRINGSET_MYMR
+ { AF_BLUE_STRING_MYANMAR_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_MYANMAR_BOTTOM, 0 }
+ { AF_BLUE_STRING_MYANMAR_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_MYANMAR_DESCENDER, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_TELU
{ AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 }
diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h
index 94e33a9..34f90e9 100644
--- a/src/autofit/afblue.h
+++ b/src/autofit/afblue.h
@@ -28,32 +28,35 @@ FT_BEGIN_HEADER
/* an auxiliary macro to decode a UTF-8 character -- since we only use */
/* hard-coded, self-converted data, no error checking is performed */
-#define GET_UTF8_CHAR( ch, p ) \
- ch = (unsigned char)*p++; \
- if ( ch >= 0x80 ) \
- { \
- FT_UInt len; \
- \
- \
- if ( ch < 0xE0 ) \
- { \
- len = 1; \
- ch &= 0x1F; \
- } \
- else if ( ch < 0xF0 ) \
- { \
- len = 2; \
- ch &= 0x0F; \
- } \
- else \
- { \
- len = 3; \
- ch &= 0x07; \
- } \
- \
- for ( ; len > 0; len-- ) \
- ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
- }
+#define GET_UTF8_CHAR( ch, p ) \
+ do \
+ { \
+ ch = (unsigned char)*p++; \
+ if ( ch >= 0x80 ) \
+ { \
+ FT_UInt len_; \
+ \
+ \
+ if ( ch < 0xE0 ) \
+ { \
+ len_ = 1; \
+ ch &= 0x1F; \
+ } \
+ else if ( ch < 0xF0 ) \
+ { \
+ len_ = 2; \
+ ch &= 0x0F; \
+ } \
+ else \
+ { \
+ len_ = 3; \
+ ch &= 0x07; \
+ } \
+ \
+ for ( ; len_ > 0; len_-- ) \
+ ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
+ } \
+ } while ( 0 )
/*************************************************************************/
@@ -75,46 +78,73 @@ FT_BEGIN_HEADER
typedef enum AF_Blue_String_
{
AF_BLUE_STRING_ARABIC_TOP = 0,
- AF_BLUE_STRING_ARABIC_JOIN = 13,
- AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 24,
- AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 41,
- AF_BLUE_STRING_CYRILLIC_SMALL = 58,
- AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 75,
- AF_BLUE_STRING_DEVANAGARI_BASE = 82,
- AF_BLUE_STRING_DEVANAGARI_TOP = 107,
- AF_BLUE_STRING_DEVANAGARI_HEAD = 132,
- AF_BLUE_STRING_DEVANAGARI_BOTTOM = 157,
- AF_BLUE_STRING_GREEK_CAPITAL_TOP = 164,
- AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 179,
- AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 192,
- AF_BLUE_STRING_GREEK_SMALL = 205,
- AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 222,
- AF_BLUE_STRING_HEBREW_TOP = 239,
- AF_BLUE_STRING_HEBREW_BOTTOM = 256,
- AF_BLUE_STRING_HEBREW_DESCENDER = 269,
- AF_BLUE_STRING_LATIN_CAPITAL_TOP = 280,
- AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 289,
- AF_BLUE_STRING_LATIN_SMALL_F_TOP = 298,
- AF_BLUE_STRING_LATIN_SMALL = 306,
- AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 314,
- AF_BLUE_STRING_TELUGU_TOP = 320,
- AF_BLUE_STRING_TELUGU_BOTTOM = 342,
- AF_BLUE_STRING_THAI_TOP = 364,
- AF_BLUE_STRING_THAI_BOTTOM = 383,
- AF_BLUE_STRING_THAI_ASCENDER = 405,
- AF_BLUE_STRING_THAI_LARGE_ASCENDER = 415,
- AF_BLUE_STRING_THAI_DESCENDER = 425,
- AF_BLUE_STRING_THAI_LARGE_DESCENDER = 438,
- AF_BLUE_STRING_THAI_DIGIT_TOP = 445,
- af_blue_1_1 = 454,
+ AF_BLUE_STRING_ARABIC_BOTTOM = 18,
+ AF_BLUE_STRING_ARABIC_JOIN = 33,
+ AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 36,
+ AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 60,
+ AF_BLUE_STRING_CYRILLIC_SMALL = 84,
+ AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 108,
+ AF_BLUE_STRING_DEVANAGARI_BASE = 117,
+ AF_BLUE_STRING_DEVANAGARI_TOP = 149,
+ AF_BLUE_STRING_DEVANAGARI_HEAD = 181,
+ AF_BLUE_STRING_DEVANAGARI_BOTTOM = 213,
+ AF_BLUE_STRING_GREEK_CAPITAL_TOP = 221,
+ AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 242,
+ AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 260,
+ AF_BLUE_STRING_GREEK_SMALL = 278,
+ AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 302,
+ AF_BLUE_STRING_HEBREW_TOP = 326,
+ AF_BLUE_STRING_HEBREW_BOTTOM = 350,
+ AF_BLUE_STRING_HEBREW_DESCENDER = 368,
+ AF_BLUE_STRING_KHMER_TOP = 383,
+ AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 407,
+ AF_BLUE_STRING_KHMER_BOTTOM = 447,
+ AF_BLUE_STRING_KHMER_DESCENDER = 479,
+ AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 513,
+ AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 600,
+ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 608,
+ AF_BLUE_STRING_LAO_TOP = 616,
+ AF_BLUE_STRING_LAO_BOTTOM = 648,
+ AF_BLUE_STRING_LAO_ASCENDER = 680,
+ AF_BLUE_STRING_LAO_LARGE_ASCENDER = 696,
+ AF_BLUE_STRING_LAO_DESCENDER = 708,
+ AF_BLUE_STRING_LATIN_CAPITAL_TOP = 732,
+ AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 748,
+ AF_BLUE_STRING_LATIN_SMALL_F_TOP = 764,
+ AF_BLUE_STRING_LATIN_SMALL = 778,
+ AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 792,
+ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 802,
+ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 822,
+ AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 842,
+ AF_BLUE_STRING_LATIN_SUBS_SMALL = 862,
+ AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 898,
+ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 918,
+ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 949,
+ AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 978,
+ AF_BLUE_STRING_LATIN_SUPS_SMALL = 1004,
+ AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 1029,
+ AF_BLUE_STRING_MYANMAR_TOP = 1040,
+ AF_BLUE_STRING_MYANMAR_BOTTOM = 1072,
+ AF_BLUE_STRING_MYANMAR_ASCENDER = 1104,
+ AF_BLUE_STRING_MYANMAR_DESCENDER = 1132,
+ AF_BLUE_STRING_TELUGU_TOP = 1164,
+ AF_BLUE_STRING_TELUGU_BOTTOM = 1192,
+ AF_BLUE_STRING_THAI_TOP = 1220,
+ AF_BLUE_STRING_THAI_BOTTOM = 1244,
+ AF_BLUE_STRING_THAI_ASCENDER = 1272,
+ AF_BLUE_STRING_THAI_LARGE_ASCENDER = 1284,
+ AF_BLUE_STRING_THAI_DESCENDER = 1296,
+ AF_BLUE_STRING_THAI_LARGE_DESCENDER = 1312,
+ AF_BLUE_STRING_THAI_DIGIT_TOP = 1320,
+ af_blue_1_1 = 1331,
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
- AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 153,
- af_blue_1_1_1 = af_blue_1_1 + 304,
+ AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203,
+ af_blue_1_1_1 = af_blue_1_1 + 404,
#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
AF_BLUE_STRING_CJK_LEFT = af_blue_1_1_1 + 1,
- AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 153,
- af_blue_1_1_2 = af_blue_1_1_1 + 304,
+ AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 204,
+ af_blue_1_1_2 = af_blue_1_1_1 + 405,
#else
af_blue_1_1_2 = af_blue_1_1_1 + 0,
#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
@@ -148,9 +178,10 @@ FT_BEGIN_HEADER
/* blue string can't be used in more than a single writing system, which */
/* is a safe bet. */
#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */
-#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 1 )
-#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 2 )
-#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 3 )
+#define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 )
+#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 )
+#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 )
+#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 )
#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */
#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */
@@ -165,14 +196,20 @@ FT_BEGIN_HEADER
typedef enum AF_Blue_Stringset_
{
AF_BLUE_STRINGSET_ARAB = 0,
- AF_BLUE_STRINGSET_CYRL = 3,
- AF_BLUE_STRINGSET_DEVA = 9,
- AF_BLUE_STRINGSET_GREK = 15,
- AF_BLUE_STRINGSET_HEBR = 22,
- AF_BLUE_STRINGSET_LATN = 26,
- AF_BLUE_STRINGSET_TELU = 33,
- AF_BLUE_STRINGSET_THAI = 36,
- af_blue_2_1 = 44,
+ AF_BLUE_STRINGSET_CYRL = 4,
+ AF_BLUE_STRINGSET_DEVA = 10,
+ AF_BLUE_STRINGSET_GREK = 16,
+ AF_BLUE_STRINGSET_HEBR = 23,
+ AF_BLUE_STRINGSET_KHMR = 27,
+ AF_BLUE_STRINGSET_KHMS = 33,
+ AF_BLUE_STRINGSET_LAO = 36,
+ AF_BLUE_STRINGSET_LATN = 42,
+ AF_BLUE_STRINGSET_LATB = 49,
+ AF_BLUE_STRINGSET_LATP = 56,
+ AF_BLUE_STRINGSET_MYMR = 63,
+ AF_BLUE_STRINGSET_TELU = 68,
+ AF_BLUE_STRINGSET_THAI = 71,
+ af_blue_2_1 = 79,
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
af_blue_2_1_1 = af_blue_2_1 + 2,
diff --git a/src/autofit/afblue.hin b/src/autofit/afblue.hin
index ad43fe6..1eb9172 100644
--- a/src/autofit/afblue.hin
+++ b/src/autofit/afblue.hin
@@ -25,32 +25,35 @@ FT_BEGIN_HEADER
/* an auxiliary macro to decode a UTF-8 character -- since we only use */
/* hard-coded, self-converted data, no error checking is performed */
-#define GET_UTF8_CHAR( ch, p ) \
- ch = (unsigned char)*p++; \
- if ( ch >= 0x80 ) \
- { \
- FT_UInt len; \
- \
- \
- if ( ch < 0xE0 ) \
- { \
- len = 1; \
- ch &= 0x1F; \
- } \
- else if ( ch < 0xF0 ) \
- { \
- len = 2; \
- ch &= 0x0F; \
- } \
- else \
- { \
- len = 3; \
- ch &= 0x07; \
- } \
- \
- for ( ; len > 0; len-- ) \
- ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
- }
+#define GET_UTF8_CHAR( ch, p ) \
+ do \
+ { \
+ ch = (unsigned char)*p++; \
+ if ( ch >= 0x80 ) \
+ { \
+ FT_UInt len_; \
+ \
+ \
+ if ( ch < 0xE0 ) \
+ { \
+ len_ = 1; \
+ ch &= 0x1F; \
+ } \
+ else if ( ch < 0xF0 ) \
+ { \
+ len_ = 2; \
+ ch &= 0x0F; \
+ } \
+ else \
+ { \
+ len_ = 3; \
+ ch &= 0x07; \
+ } \
+ \
+ for ( ; len_ > 0; len_-- ) \
+ ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
+ } \
+ } while ( 0 )
/*************************************************************************/
@@ -97,9 +100,10 @@ FT_BEGIN_HEADER
/* blue string can't be used in more than a single writing system, which */
/* is a safe bet. */
#define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */
-#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 1 )
-#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 2 )
-#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 3 )
+#define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 )
+#define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 )
+#define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 )
+#define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 )
#define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */
#define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 905408b..73d75ae 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -88,7 +88,6 @@
{
FT_Error error;
FT_ULong glyph_index;
- FT_Long y_offset;
int dim;
AF_CJKMetricsRec dummy[1];
AF_Scaler scaler = &dummy->root.scaler;
@@ -101,45 +100,61 @@
AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET
[style_class->script];
- FT_UInt32 standard_char;
+ void* shaper_buf;
+ const char* p;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_ULong ch;
+#endif
- standard_char = script_class->standard_char1;
- af_get_char_index( &metrics->root,
- standard_char,
- &glyph_index,
- &y_offset );
- if ( !glyph_index )
+ p = script_class->standard_charstring;
+ shaper_buf = af_shaper_buf_create( face );
+
+ /* We check a list of standard characters. The first match wins. */
+
+ glyph_index = 0;
+ while ( *p )
{
- if ( script_class->standard_char2 )
- {
- standard_char = script_class->standard_char2;
- af_get_char_index( &metrics->root,
- standard_char,
- &glyph_index,
- &y_offset );
- if ( !glyph_index )
- {
- if ( script_class->standard_char3 )
- {
- standard_char = script_class->standard_char3;
- af_get_char_index( &metrics->root,
- standard_char,
- &glyph_index,
- &y_offset );
- if ( !glyph_index )
- goto Exit;
- }
- else
- goto Exit;
- }
- }
- else
- goto Exit;
+ unsigned int num_idx;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ const char* p_old;
+#endif
+
+
+ while ( *p == ' ' )
+ p++;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ p_old = p;
+ GET_UTF8_CHAR( ch, p_old );
+#endif
+
+ /* reject input that maps to more than a single glyph */
+ p = af_shaper_get_cluster( p, &metrics->root, shaper_buf, &num_idx );
+ if ( num_idx > 1 )
+ continue;
+
+ /* otherwise exit loop if we have a result */
+ glyph_index = af_shaper_get_elem( &metrics->root,
+ shaper_buf,
+ 0,
+ NULL,
+ NULL );
+ if ( glyph_index )
+ break;
}
+ af_shaper_buf_destroy( face, shaper_buf );
+
+ if ( !glyph_index )
+ goto Exit;
+
+ if ( !glyph_index )
+ goto Exit;
+
FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
- standard_char, glyph_index ));
+ ch, glyph_index ));
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
if ( error || face->glyph->outline.n_points <= 0 )
@@ -177,6 +192,12 @@
if ( error )
goto Exit;
+ /*
+ * We assume that the glyphs selected for the stem width
+ * computation are `featureless' enough so that the linking
+ * algorithm works fine without adjustments of its scoring
+ * function.
+ */
af_latin_hints_link_segments( hints,
0,
NULL,
@@ -275,6 +296,8 @@
AF_Blue_Stringset bss = sc->blue_stringset;
const AF_Blue_StringRec* bs = &af_blue_stringsets[bss];
+ void* shaper_buf;
+
/* we walk over the blue character strings as specified in the */
/* style's entry in the `af_blue_stringset' array, computing its */
@@ -284,6 +307,8 @@
"==========================\n"
"\n" ));
+ shaper_buf = af_shaper_buf_create( face );
+
for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ )
{
const char* p = &af_blue_strings[bs->string];
@@ -322,26 +347,47 @@
while ( *p )
{
- FT_ULong ch;
FT_ULong glyph_index;
- FT_Long y_offset;
FT_Pos best_pos; /* same as points.y or points.x, resp. */
FT_Int best_point;
FT_Vector* points;
+ unsigned int num_idx;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ const char* p_old;
+ FT_ULong ch;
+#endif
+
- GET_UTF8_CHAR( ch, p );
+ while ( *p == ' ' )
+ p++;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ p_old = p;
+ GET_UTF8_CHAR( ch, p_old );
+#endif
/* switch to characters that define flat values */
- if ( ch == '|' )
+ if ( *p == '|' )
{
fill = 0;
FT_TRACE5(( " [reference values]\n" ));
+ p++;
continue;
}
+ /* reject input that maps to more than a single glyph */
+ p = af_shaper_get_cluster( p, &metrics->root, shaper_buf, &num_idx );
+ if ( num_idx > 1 )
+ continue;
+
/* load the character in the face -- skip unknown or empty ones */
- af_get_char_index( &metrics->root, ch, &glyph_index, &y_offset );
+ glyph_index = af_shaper_get_elem( &metrics->root,
+ shaper_buf,
+ 0,
+ NULL,
+ NULL );
if ( glyph_index == 0 )
{
FT_TRACE5(( " U+%04lX unavailable\n", ch ));
@@ -350,9 +396,9 @@
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
outline = face->glyph->outline;
- if ( error || outline.n_points <= 0 )
+ if ( error || outline.n_points <= 2 )
{
- FT_TRACE5(( " U+%04lX contains no outlines\n", ch ));
+ FT_TRACE5(( " U+%04lX contains no (usable) outlines\n", ch ));
continue;
}
@@ -431,7 +477,8 @@
fills[num_fills++] = best_pos;
else
flats[num_flats++] = best_pos;
- }
+
+ } /* end while loop */
if ( num_flats == 0 && num_fills == 0 )
{
@@ -498,7 +545,10 @@
FT_TRACE5(( " -> reference = %ld\n"
" overshoot = %ld\n",
*blue_ref, *blue_shoot ));
- }
+
+ } /* end for loop */
+
+ af_shaper_buf_destroy( face, shaper_buf );
FT_TRACE5(( "\n" ));
@@ -512,27 +562,36 @@
af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
FT_Face face )
{
- FT_UInt i;
FT_Bool started = 0, same_width = 1;
FT_Fixed advance, old_advance = 0;
+ void* shaper_buf;
- /* digit `0' is 0x30 in all supported charmaps */
- for ( i = 0x30; i <= 0x39; i++ )
+ /* in all supported charmaps, digits have character codes 0x30-0x39 */
+ const char digits[] = "0 1 2 3 4 5 6 7 8 9";
+ const char* p;
+
+
+ p = digits;
+ shaper_buf = af_shaper_buf_create( face );
+
+ while ( *p )
{
- FT_ULong glyph_index;
- FT_Long y_offset;
+ FT_ULong glyph_index;
+ unsigned int num_idx;
- af_get_char_index( &metrics->root, i, &glyph_index, &y_offset );
- if ( glyph_index == 0 )
+ /* reject input that maps to more than a single glyph */
+ p = af_shaper_get_cluster( p, &metrics->root, shaper_buf, &num_idx );
+ if ( num_idx > 1 )
continue;
- if ( FT_Get_Advance( face, glyph_index,
- FT_LOAD_NO_SCALE |
- FT_LOAD_NO_HINTING |
- FT_LOAD_IGNORE_TRANSFORM,
- &advance ) )
+ glyph_index = af_shaper_get_elem( &metrics->root,
+ shaper_buf,
+ 0,
+ &advance,
+ NULL );
+ if ( !glyph_index )
continue;
if ( started )
@@ -550,6 +609,8 @@
}
}
+ af_shaper_buf_destroy( face, shaper_buf );
+
metrics->root.digits_have_same_width = same_width;
}
@@ -688,6 +749,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;
+ }
+
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -2181,7 +2258,8 @@
/* Apply the complete hinting algorithm to a CJK glyph. */
FT_LOCAL_DEF( FT_Error )
- af_cjk_hints_apply( AF_GlyphHints hints,
+ af_cjk_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_CJKMetrics metrics )
{
@@ -2189,6 +2267,7 @@
int dim;
FT_UNUSED( metrics );
+ FT_UNUSED( glyph_index );
error = af_glyph_hints_reload( hints, outline );
@@ -2278,6 +2357,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
@@ -2297,6 +2377,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
diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h
index bfd11f2..e395e74 100644
--- a/src/autofit/afcjk.h
+++ b/src/autofit/afcjk.h
@@ -115,7 +115,8 @@ FT_BEGIN_HEADER
AF_CJKMetrics metrics );
FT_LOCAL( FT_Error )
- af_cjk_hints_apply( AF_GlyphHints hints,
+ af_cjk_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_CJKMetrics metrics );
diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c
index 03ca25f..9142c78 100644
--- a/src/autofit/afdummy.c
+++ b/src/autofit/afdummy.c
@@ -38,11 +38,14 @@
static FT_Error
- af_dummy_hints_apply( AF_GlyphHints hints,
+ af_dummy_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline )
{
FT_Error error;
+ FT_UNUSED( glyph_index );
+
error = af_glyph_hints_reload( hints, outline );
if ( !error )
@@ -62,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
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 64b9293..3223358 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -18,7 +18,7 @@
#include "afglobal.h"
#include "afranges.h"
-#include "hbshim.h"
+#include "afshaper.h"
#include FT_INTERNAL_DEBUG_H
@@ -42,12 +42,13 @@
#undef SCRIPT
-#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \
+#define SCRIPT( s, S, d, h, ss ) \
AF_DEFINE_SCRIPT_CLASS( \
af_ ## s ## _script_class, \
AF_SCRIPT_ ## S, \
af_ ## s ## _uniranges, \
- sc1, sc2, sc3 )
+ af_ ## s ## _nonbase_uniranges, \
+ ss )
#include "afscript.h"
@@ -82,7 +83,7 @@
#undef SCRIPT
-#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \
+#define SCRIPT( s, S, d, h, ss ) \
&af_ ## s ## _script_class,
FT_LOCAL_ARRAY_DEF( AF_ScriptClass )
@@ -135,16 +136,15 @@
FT_Error error;
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
- FT_Byte* gstyles = globals->glyph_styles;
+ FT_UShort* gstyles = globals->glyph_styles;
FT_UInt ss;
FT_UInt i;
FT_UInt dflt = ~0U; /* a non-valid value */
/* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */
- FT_MEM_SET( globals->glyph_styles,
- AF_STYLE_UNASSIGNED,
- globals->glyph_count );
+ for ( i = 0; i < (FT_UInt)globals->glyph_count; i++ )
+ gstyles[i] = AF_STYLE_UNASSIGNED;
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
if ( error )
@@ -190,10 +190,10 @@
gindex = FT_Get_Char_Index( face, charcode );
- if ( gindex != 0 &&
- gindex < (FT_ULong)globals->glyph_count &&
- gstyles[gindex] == AF_STYLE_UNASSIGNED )
- gstyles[gindex] = (FT_Byte)ss;
+ if ( gindex != 0 &&
+ gindex < (FT_ULong)globals->glyph_count &&
+ ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
+ gstyles[gindex] = (FT_UShort)ss;
for (;;)
{
@@ -202,21 +202,50 @@
if ( gindex == 0 || charcode > range->last )
break;
- if ( gindex < (FT_ULong)globals->glyph_count &&
- gstyles[gindex] == AF_STYLE_UNASSIGNED )
- gstyles[gindex] = (FT_Byte)ss;
+ if ( gindex < (FT_ULong)globals->glyph_count &&
+ ( gstyles[gindex] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
+ gstyles[gindex] = (FT_UShort)ss;
+ }
+ }
+
+ /* do the same for the script's non-base characters */
+ for ( range = script_class->script_uni_nonbase_ranges;
+ range->first != 0;
+ range++ )
+ {
+ FT_ULong charcode = range->first;
+ FT_UInt gindex;
+
+
+ gindex = FT_Get_Char_Index( face, charcode );
+
+ if ( gindex != 0 &&
+ gindex < (FT_ULong)globals->glyph_count &&
+ ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
+ gstyles[gindex] |= AF_NONBASE;
+
+ for (;;)
+ {
+ charcode = FT_Get_Next_Char( face, charcode, &gindex );
+
+ if ( gindex == 0 || charcode > range->last )
+ break;
+
+ if ( gindex < (FT_ULong)globals->glyph_count &&
+ ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss )
+ gstyles[gindex] |= AF_NONBASE;
}
}
}
else
{
/* get glyphs not directly addressable by cmap */
- af_get_coverage( globals, style_class, gstyles );
+ af_shaper_get_coverage( globals, style_class, gstyles );
}
}
/* handle the default OpenType features of the default script ... */
- af_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles );
+ af_shaper_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles );
/* ... and the remaining default OpenType features */
for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
@@ -225,7 +254,7 @@
if ( ss != dflt && style_class->coverage == AF_COVERAGE_DEFAULT )
- af_get_coverage( globals, style_class, gstyles );
+ af_shaper_get_coverage( globals, style_class, gstyles );
}
/* mark ASCII digits */
@@ -250,9 +279,9 @@
for ( nn = 0; nn < globals->glyph_count; nn++ )
{
- if ( ( gstyles[nn] & ~AF_DIGIT ) == AF_STYLE_UNASSIGNED )
+ if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED )
{
- gstyles[nn] &= ~AF_STYLE_UNASSIGNED;
+ gstyles[nn] &= ~AF_STYLE_MASK;
gstyles[nn] |= globals->module->fallback_style;
}
}
@@ -276,7 +305,7 @@
for ( idx = 0; idx < globals->glyph_count; idx++ )
{
- if ( ( gstyles[idx] & ~AF_DIGIT ) == style_class->style )
+ if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style )
{
if ( !( count % 10 ) )
FT_TRACE4(( " " ));
@@ -314,18 +343,28 @@
memory = face->memory;
+ /* we allocate an AF_FaceGlobals structure together */
+ /* with the glyph_styles array */
if ( FT_ALLOC( globals,
sizeof ( *globals ) +
- (FT_ULong)face->num_glyphs * sizeof ( FT_Byte ) ) )
+ (FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
goto Exit;
- globals->face = face;
- globals->glyph_count = face->num_glyphs;
- globals->glyph_styles = (FT_Byte*)( globals + 1 );
- globals->module = module;
+ globals->face = face;
+ globals->glyph_count = face->num_glyphs;
+ /* right after the globals structure come the glyph styles */
+ globals->glyph_styles = (FT_UShort*)( globals + 1 );
+ globals->module = module;
+ globals->stem_darkening_for_ppem = 0;
+ globals->darken_x = 0;
+ globals->darken_y = 0;
+ globals->standard_vertical_width = 0;
+ globals->standard_horizontal_width = 0;
+ globals->scale_down_factor = 0;
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
globals->hb_font = hb_ft_font_create( face, NULL );
+ globals->hb_buf = hb_buffer_create();
#endif
error = af_face_globals_compute_style_coverage( globals );
@@ -372,11 +411,21 @@
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
hb_font_destroy( globals->hb_font );
globals->hb_font = NULL;
+
+ hb_buffer_destroy( globals->hb_buf );
+ globals->hb_buf = NULL;
#endif
- globals->glyph_count = 0;
- globals->glyph_styles = NULL; /* no need to free this one! */
- globals->face = NULL;
+ globals->glyph_count = 0;
+ globals->stem_darkening_for_ppem = 0;
+ globals->darken_x = 0;
+ globals->darken_y = 0;
+ globals->standard_vertical_width = 0;
+ globals->standard_horizontal_width = 0;
+ globals->scale_down_factor = 0;
+ /* no need to free this one! */
+ globals->glyph_styles = NULL;
+ globals->face = NULL;
FT_FREE( globals );
}
diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h
index 9bbb687..5b4e439 100644
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -23,7 +23,7 @@
#include "aftypes.h"
#include "afmodule.h"
-#include "hbshim.h"
+#include "afshaper.h"
FT_BEGIN_HEADER
@@ -34,7 +34,7 @@ FT_BEGIN_HEADER
#undef SCRIPT
-#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \
+#define SCRIPT( s, S, d, h, ss ) \
AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class )
#include "afscript.h"
@@ -72,10 +72,16 @@ FT_BEGIN_HEADER
#endif
/* default script for OpenType; ignored if HarfBuzz isn't used */
#define AF_SCRIPT_DEFAULT AF_SCRIPT_LATN
- /* a bit mask indicating an uncovered glyph */
-#define AF_STYLE_UNASSIGNED 0x7F
- /* if this flag is set, we have an ASCII digit */
-#define AF_DIGIT 0x80
+
+ /* a bit mask for AF_DIGIT and AF_NONBASE */
+#define AF_STYLE_MASK 0x3FFF
+ /* an uncovered glyph */
+#define AF_STYLE_UNASSIGNED AF_STYLE_MASK
+
+ /* if this flag is set, we have an ASCII digit */
+#define AF_DIGIT 0x8000U
+ /* if this flag is set, we have a non-base character */
+#define AF_NONBASE 0x4000U
/* `increase-x-height' property */
#define AF_PROP_INCREASE_X_HEIGHT_MIN 6
@@ -100,10 +106,11 @@ FT_BEGIN_HEADER
{
FT_Face face;
FT_Long glyph_count; /* same as face->num_glyphs */
- FT_Byte* glyph_styles;
+ FT_UShort* glyph_styles;
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
hb_font_t* hb_font;
+ hb_buffer_t* hb_buf; /* for feature comparison */
#endif
/* per-face auto-hinter properties */
@@ -111,6 +118,22 @@ FT_BEGIN_HEADER
AF_StyleMetrics metrics[AF_STYLE_MAX];
+ /* Compute darkening amount once per size. Use this to check whether */
+ /* darken_{x,y} needs to be recomputed. */
+ FT_UShort stem_darkening_for_ppem;
+ /* Copy from e.g. AF_LatinMetrics.axis[AF_DIMENSION_HORZ] */
+ /* to compute the darkening amount. */
+ FT_Pos standard_vertical_width;
+ /* Copy from e.g. AF_LatinMetrics.axis[AF_DIMENSION_VERT] */
+ /* to compute the darkening amount. */
+ FT_Pos standard_horizontal_width;
+ /* The actual amount to darken a glyph along the X axis. */
+ FT_Pos darken_x;
+ /* The actual amount to darken a glyph along the Y axis. */
+ FT_Pos darken_y;
+ /* Amount to scale down by to keep emboldened points */
+ /* on the Y-axis in pre-computed blue zones. */
+ FT_Fixed scale_down_factor;
AF_Module module; /* to access global properties */
} AF_FaceGlobalsRec;
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index 37482eb..56c8220 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -219,6 +219,82 @@
#define AF_INDEX_NUM( ptr, base ) (int)( (ptr) ? ( (ptr) - (base) ) : -1 )
+ static char*
+ af_print_idx( char* p,
+ int idx )
+ {
+ if ( idx == -1 )
+ {
+ p[0] = '-';
+ p[1] = '-';
+ p[2] = '\0';
+ }
+ else
+ ft_sprintf( p, "%d", idx );
+
+ return p;
+ }
+
+
+ static int
+ af_get_segment_index( AF_GlyphHints hints,
+ int point_idx,
+ int dimension )
+ {
+ AF_AxisHints axis = &hints->axis[dimension];
+ AF_Point point = hints->points + point_idx;
+ AF_Segment segments = axis->segments;
+ AF_Segment limit = segments + axis->num_segments;
+ AF_Segment segment;
+
+
+ for ( segment = segments; segment < limit; segment++ )
+ {
+ if ( segment->first <= segment->last )
+ {
+ if ( point >= segment->first && point <= segment->last )
+ break;
+ }
+ else
+ {
+ AF_Point p = segment->first;
+
+
+ for (;;)
+ {
+ if ( point == p )
+ goto Exit;
+
+ if ( p == segment->last )
+ break;
+
+ p = p->next;
+ }
+ }
+ }
+
+ Exit:
+ if ( segment == limit )
+ return -1;
+
+ return (int)( segment - segments );
+ }
+
+
+ static int
+ af_get_edge_index( AF_GlyphHints hints,
+ int segment_idx,
+ int dimension )
+ {
+ AF_AxisHints axis = &hints->axis[dimension];
+ AF_Edge edges = axis->edges;
+ AF_Segment segment = axis->segments + segment_idx;
+
+
+ return segment_idx == -1 ? -1 : AF_INDEX_NUM( segment->edge, edges );
+ }
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -234,22 +310,39 @@
AF_DUMP(( "Table of points:\n" ));
if ( hints->num_points )
- AF_DUMP(( " [ index | xorg | yorg | xscale | yscale"
- " | xfit | yfit | flags ]\n" ));
+ AF_DUMP(( " index hedge hseg vedge vseg flags"
+ " xorg yorg xscale yscale xfit yfit\n" ));
else
AF_DUMP(( " (none)\n" ));
for ( point = points; point < limit; point++ )
- AF_DUMP(( " [ %5d | %5d | %5d | %6.2f | %6.2f"
- " | %5.2f | %5.2f | %c ]\n",
- AF_INDEX_NUM( point, points ),
+ {
+ int point_idx = AF_INDEX_NUM( point, points );
+ int segment_idx_0 = af_get_segment_index( hints, point_idx, 0 );
+ int segment_idx_1 = af_get_segment_index( hints, point_idx, 1 );
+
+ char buf1[16], buf2[16], buf3[16], buf4[16];
+
+
+ AF_DUMP(( " %5d %5s %5s %5s %5s %s "
+ " %5d %5d %7.2f %7.2f %7.2f %7.2f\n",
+ point_idx,
+ af_print_idx( buf1,
+ af_get_edge_index( hints, segment_idx_1, 1 ) ),
+ af_print_idx( buf2, segment_idx_1 ),
+ af_print_idx( buf3,
+ af_get_edge_index( hints, segment_idx_0, 0 ) ),
+ af_print_idx( buf4, segment_idx_0 ),
+ ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? "weak"
+ : " -- ",
+
point->fx,
point->fy,
point->ox / 64.0,
point->oy / 64.0,
point->x / 64.0,
- point->y / 64.0,
- ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' '));
+ point->y / 64.0 ));
+ }
AF_DUMP(( "\n" ));
}
#ifdef __cplusplus
@@ -306,21 +399,23 @@
AF_Segment limit = segments + axis->num_segments;
AF_Segment seg;
+ char buf1[16], buf2[16], buf3[16];
+
AF_DUMP(( "Table of %s segments:\n",
dimension == AF_DIMENSION_HORZ ? "vertical"
: "horizontal" ));
if ( axis->num_segments )
- AF_DUMP(( " [ index | pos | dir | from"
- " | to | link | serif | edge"
- " | height | extra | flags ]\n" ));
+ AF_DUMP(( " index pos dir from to"
+ " link serif edge"
+ " height extra flags\n" ));
else
AF_DUMP(( " (none)\n" ));
for ( seg = segments; seg < limit; seg++ )
- AF_DUMP(( " [ %5d | %5.2g | %5s | %4d"
- " | %4d | %4d | %5d | %4d"
- " | %6d | %5d | %11s ]\n",
+ AF_DUMP(( " %5d %5.2g %5s %4d %4d"
+ " %4s %5s %4s"
+ " %6d %5d %11s\n",
AF_INDEX_NUM( seg, segments ),
dimension == AF_DIMENSION_HORZ
? (int)seg->first->ox / 64.0
@@ -328,9 +423,11 @@
af_dir_str( (AF_Direction)seg->dir ),
AF_INDEX_NUM( seg->first, points ),
AF_INDEX_NUM( seg->last, points ),
- AF_INDEX_NUM( seg->link, segments ),
- AF_INDEX_NUM( seg->serif, segments ),
- AF_INDEX_NUM( seg->edge, edges ),
+
+ af_print_idx( buf1, AF_INDEX_NUM( seg->link, segments ) ),
+ af_print_idx( buf2, AF_INDEX_NUM( seg->serif, segments ) ),
+ af_print_idx( buf3, AF_INDEX_NUM( seg->edge, edges ) ),
+
seg->height,
seg->height - ( seg->max_coord - seg->min_coord ),
af_edge_flags_to_string( seg->flags ) ));
@@ -435,6 +532,8 @@
AF_Edge limit = edges + axis->num_edges;
AF_Edge edge;
+ char buf1[16], buf2[16];
+
/*
* note: AF_DIMENSION_HORZ corresponds to _vertical_ edges
@@ -444,19 +543,20 @@
dimension == AF_DIMENSION_HORZ ? "vertical"
: "horizontal" ));
if ( axis->num_edges )
- AF_DUMP(( " [ index | pos | dir | link"
- " | serif | blue | opos | pos | flags ]\n" ));
+ AF_DUMP(( " index pos dir link serif"
+ " blue opos pos flags\n" ));
else
AF_DUMP(( " (none)\n" ));
for ( edge = edges; edge < limit; edge++ )
- AF_DUMP(( " [ %5d | %5.2g | %5s | %4d"
- " | %5d | %c | %5.2f | %5.2f | %11s ]\n",
+ AF_DUMP(( " %5d %5.2g %5s %4s %5s"
+ " %c %5.2f %5.2f %11s\n",
AF_INDEX_NUM( edge, edges ),
(int)edge->opos / 64.0,
af_dir_str( (AF_Direction)edge->dir ),
- AF_INDEX_NUM( edge->link, edges ),
- AF_INDEX_NUM( edge->serif, edges ),
+ af_print_idx( buf1, AF_INDEX_NUM( edge->link, edges ) ),
+ af_print_idx( buf2, AF_INDEX_NUM( edge->serif, edges ) ),
+
edge->blue_edge ? 'y' : 'n',
edge->opos / 64.0,
edge->pos / 64.0,
diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c
index 7412cd1..59b14d7 100644
--- a/src/autofit/afindic.c
+++ b/src/autofit/afindic.c
@@ -79,12 +79,29 @@
static FT_Error
- af_indic_hints_apply( AF_GlyphHints hints,
+ af_indic_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_CJKMetrics metrics )
{
/* use CJK routines */
- return af_cjk_hints_apply( hints, outline, metrics );
+ return af_cjk_hints_apply( glyph_index, hints, outline, metrics );
+ }
+
+
+ /* 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;
}
@@ -107,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
@@ -126,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
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 893e986..9c9f370 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -41,6 +41,10 @@
#define FT_COMPONENT trace_aflatin
+ /* needed for computation of round vs. flat segments */
+#define FLAT_THRESHOLD( x ) ( x / 14 )
+
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -75,7 +79,6 @@
{
FT_Error error;
FT_ULong glyph_index;
- FT_Long y_offset;
int dim;
AF_LatinMetricsRec dummy[1];
AF_Scaler scaler = &dummy->root.scaler;
@@ -88,52 +91,63 @@
AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET
[style_class->script];
- FT_UInt32 standard_char;
+ void* shaper_buf;
+ const char* p;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_ULong ch;
+#endif
+ p = script_class->standard_charstring;
+ shaper_buf = af_shaper_buf_create( face );
/*
- * We check more than a single standard character to catch features
- * like `c2sc' (small caps from caps) that don't contain lowercase
- * letters by definition, or other features that mainly operate on
- * numerals.
+ * We check a list of standard characters to catch features like
+ * `c2sc' (small caps from caps) that don't contain lowercase letters
+ * by definition, or other features that mainly operate on numerals.
+ * The first match wins.
*/
- standard_char = script_class->standard_char1;
- af_get_char_index( &metrics->root,
- standard_char,
- &glyph_index,
- &y_offset );
- if ( !glyph_index )
+ glyph_index = 0;
+ while ( *p )
{
- if ( script_class->standard_char2 )
- {
- standard_char = script_class->standard_char2;
- af_get_char_index( &metrics->root,
- standard_char,
- &glyph_index,
- &y_offset );
- if ( !glyph_index )
- {
- if ( script_class->standard_char3 )
- {
- standard_char = script_class->standard_char3;
- af_get_char_index( &metrics->root,
- standard_char,
- &glyph_index,
- &y_offset );
- if ( !glyph_index )
- goto Exit;
- }
- else
- goto Exit;
- }
- }
- else
- goto Exit;
+ unsigned int num_idx;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ const char* p_old;
+#endif
+
+
+ while ( *p == ' ' )
+ p++;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ p_old = p;
+ GET_UTF8_CHAR( ch, p_old );
+#endif
+
+ /* reject input that maps to more than a single glyph */
+ p = af_shaper_get_cluster( p, &metrics->root, shaper_buf, &num_idx );
+ if ( num_idx > 1 )
+ continue;
+
+ /* otherwise exit loop if we have a result */
+ glyph_index = af_shaper_get_elem( &metrics->root,
+ shaper_buf,
+ 0,
+ NULL,
+ NULL );
+ if ( glyph_index )
+ break;
}
+ af_shaper_buf_destroy( face, shaper_buf );
+
+ if ( !glyph_index )
+ goto Exit;
+
FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
- standard_char, glyph_index ));
+ ch, glyph_index ));
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
if ( error || face->glyph->outline.n_points <= 0 )
@@ -274,6 +288,10 @@
AF_Blue_Stringset bss = sc->blue_stringset;
const AF_Blue_StringRec* bs = &af_blue_stringsets[bss];
+ FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em );
+
+ void* shaper_buf;
+
/* we walk over the blue character strings as specified in the */
/* style's entry in the `af_blue_stringset' array */
@@ -282,11 +300,15 @@
"============================\n"
"\n" ));
+ shaper_buf = af_shaper_buf_create( face );
+
for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ )
{
const char* p = &af_blue_strings[bs->string];
FT_Pos* blue_ref;
FT_Pos* blue_shoot;
+ FT_Pos ascender;
+ FT_Pos descender;
#ifdef FT_DEBUG_LEVEL_TRACE
@@ -305,6 +327,11 @@
FT_TRACE5(( "top" ));
have_flag = 1;
}
+ else if ( AF_LATIN_IS_SUB_TOP_BLUE( bs ) )
+ {
+ FT_TRACE5(( "sub top" ));
+ have_flag = 1;
+ }
if ( AF_LATIN_IS_NEUTRAL_BLUE( bs ) )
{
@@ -338,394 +365,482 @@
num_flats = 0;
num_rounds = 0;
+ ascender = 0;
+ descender = 0;
while ( *p )
{
- FT_ULong ch;
FT_ULong glyph_index;
FT_Long y_offset;
- FT_Pos best_y; /* same as points.y */
FT_Int best_point, best_contour_first, best_contour_last;
FT_Vector* points;
- FT_Bool round = 0;
+ FT_Pos best_y_extremum; /* same as points.y */
+ FT_Bool best_round = 0;
- GET_UTF8_CHAR( ch, p );
+ unsigned int i, num_idx;
- /* load the character in the face -- skip unknown or empty ones */
- af_get_char_index( &metrics->root, ch, &glyph_index, &y_offset );
- if ( glyph_index == 0 )
- {
- FT_TRACE5(( " U+%04lX unavailable\n", ch ));
- continue;
- }
+#ifdef FT_DEBUG_LEVEL_TRACE
+ const char* p_old;
+ FT_ULong ch;
+#endif
+
+
+ while ( *p == ' ' )
+ p++;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ p_old = p;
+ GET_UTF8_CHAR( ch, p_old );
+#endif
- error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
- outline = face->glyph->outline;
- /* reject glyphs that don't produce any rendering */
- if ( error || outline.n_points <= 2 )
+ p = af_shaper_get_cluster( p, &metrics->root, shaper_buf, &num_idx );
+
+ if ( !num_idx )
{
- FT_TRACE5(( " U+%04lX contains no (usable) outlines\n", ch ));
+ FT_TRACE5(( " U+%04lX unavailable\n", ch ));
continue;
}
- /* now compute min or max point indices and coordinates */
- points = outline.points;
- best_point = -1;
- best_y = 0; /* make compiler happy */
- best_contour_first = 0; /* ditto */
- best_contour_last = 0; /* ditto */
+ if ( AF_LATIN_IS_TOP_BLUE( bs ) )
+ best_y_extremum = FT_INT_MIN;
+ else
+ best_y_extremum = FT_INT_MAX;
+ /* iterate over all glyph elements of the character cluster */
+ /* and get the data of the `biggest' one */
+ for ( i = 0; i < num_idx; i++ )
{
- FT_Int nn;
- FT_Int first = 0;
- FT_Int last = -1;
+ FT_Pos best_y;
+ FT_Bool round = 0;
- for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ )
+ /* load the character in the face -- skip unknown or empty ones */
+ glyph_index = af_shaper_get_elem( &metrics->root,
+ shaper_buf,
+ i,
+ NULL,
+ &y_offset );
+ if ( glyph_index == 0 )
{
- FT_Int old_best_point = best_point;
- FT_Int pp;
+ FT_TRACE5(( " U+%04lX unavailable\n", ch ));
+ continue;
+ }
+ error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
+ outline = face->glyph->outline;
+ /* reject glyphs that don't produce any rendering */
+ if ( error || outline.n_points <= 2 )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( num_idx == 1 )
+ FT_TRACE5(( " U+%04lX contains no (usable) outlines\n", ch ));
+ else
+ FT_TRACE5(( " component %d of cluster starting with U+%04lX"
+ " contains no (usable) outlines\n", i, ch ));
+#endif
+ continue;
+ }
- last = outline.contours[nn];
+ /* now compute min or max point indices and coordinates */
+ points = outline.points;
+ best_point = -1;
+ best_y = 0; /* make compiler happy */
+ best_contour_first = 0; /* ditto */
+ best_contour_last = 0; /* ditto */
- /* Avoid single-point contours since they are never rasterized. */
- /* In some fonts, they correspond to mark attachment points */
- /* that are way outside of the glyph's real outline. */
- if ( last <= first )
- continue;
+ {
+ FT_Int nn;
+ FT_Int first = 0;
+ FT_Int last = -1;
- if ( AF_LATIN_IS_TOP_BLUE( bs ) )
+
+ for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ )
{
- for ( pp = first; pp <= last; pp++ )
- if ( best_point < 0 || points[pp].y > best_y )
+ FT_Int old_best_point = best_point;
+ FT_Int pp;
+
+
+ last = outline.contours[nn];
+
+ /* Avoid single-point contours since they are never */
+ /* rasterized. In some fonts, they correspond to mark */
+ /* attachment points that are way outside of the glyph's */
+ /* real outline. */
+ if ( last <= first )
+ continue;
+
+ if ( AF_LATIN_IS_TOP_BLUE( bs ) ||
+ AF_LATIN_IS_SUB_TOP_BLUE( bs ) )
+ {
+ for ( pp = first; pp <= last; pp++ )
{
- best_point = pp;
- best_y = points[pp].y;
+ if ( best_point < 0 || points[pp].y > best_y )
+ {
+ best_point = pp;
+ best_y = points[pp].y;
+ ascender = FT_MAX( ascender, best_y + y_offset );
+ }
+ else
+ descender = FT_MIN( descender, points[pp].y + y_offset );
}
- }
- else
- {
- for ( pp = first; pp <= last; pp++ )
- if ( best_point < 0 || points[pp].y < best_y )
+ }
+ else
+ {
+ for ( pp = first; pp <= last; pp++ )
{
- best_point = pp;
- best_y = points[pp].y;
+ if ( best_point < 0 || points[pp].y < best_y )
+ {
+ best_point = pp;
+ best_y = points[pp].y;
+ descender = FT_MIN( descender, best_y + y_offset );
+ }
+ else
+ ascender = FT_MAX( ascender, points[pp].y + y_offset );
}
- }
+ }
- if ( best_point != old_best_point )
- {
- best_contour_first = first;
- best_contour_last = last;
+ if ( best_point != old_best_point )
+ {
+ best_contour_first = first;
+ best_contour_last = last;
+ }
}
}
- }
-
- /* now check whether the point belongs to a straight or round */
- /* segment; we first need to find in which contour the extremum */
- /* lies, then inspect its previous and next points */
- if ( best_point >= 0 )
- {
- FT_Pos best_x = points[best_point].x;
- FT_Int prev, next;
- FT_Int best_segment_first, best_segment_last;
- FT_Int best_on_point_first, best_on_point_last;
- FT_Pos dist;
-
- best_segment_first = best_point;
- best_segment_last = best_point;
-
- if ( FT_CURVE_TAG( outline.tags[best_point] ) == FT_CURVE_TAG_ON )
+ /* now check whether the point belongs to a straight or round */
+ /* segment; we first need to find in which contour the extremum */
+ /* lies, then inspect its previous and next points */
+ if ( best_point >= 0 )
{
- best_on_point_first = best_point;
- best_on_point_last = best_point;
- }
- else
- {
- best_on_point_first = -1;
- best_on_point_last = -1;
- }
+ FT_Pos best_x = points[best_point].x;
+ FT_Int prev, next;
+ FT_Int best_segment_first, best_segment_last;
+ FT_Int best_on_point_first, best_on_point_last;
+ FT_Pos dist;
- /* look for the previous and next points on the contour */
- /* that are not on the same Y coordinate, then threshold */
- /* the `closeness'... */
- prev = best_point;
- next = prev;
- do
- {
- if ( prev > best_contour_first )
- prev--;
- else
- prev = best_contour_last;
+ best_segment_first = best_point;
+ best_segment_last = best_point;
- dist = FT_ABS( points[prev].y - best_y );
- /* accept a small distance or a small angle (both values are */
- /* heuristic; value 20 corresponds to approx. 2.9 degrees) */
- if ( dist > 5 )
- if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )
- break;
+ if ( FT_CURVE_TAG( outline.tags[best_point] ) == FT_CURVE_TAG_ON )
+ {
+ best_on_point_first = best_point;
+ best_on_point_last = best_point;
+ }
+ else
+ {
+ best_on_point_first = -1;
+ best_on_point_last = -1;
+ }
- best_segment_first = prev;
+ /* look for the previous and next points on the contour */
+ /* that are not on the same Y coordinate, then threshold */
+ /* the `closeness'... */
+ prev = best_point;
+ next = prev;
- if ( FT_CURVE_TAG( outline.tags[prev] ) == FT_CURVE_TAG_ON )
+ do
{
- best_on_point_first = prev;
- if ( best_on_point_last < 0 )
- best_on_point_last = prev;
- }
+ if ( prev > best_contour_first )
+ prev--;
+ else
+ prev = best_contour_last;
- } while ( prev != best_point );
+ dist = FT_ABS( points[prev].y - best_y );
+ /* accept a small distance or a small angle (both values are */
+ /* heuristic; value 20 corresponds to approx. 2.9 degrees) */
+ if ( dist > 5 )
+ if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )
+ break;
- do
- {
- if ( next < best_contour_last )
- next++;
- else
- next = best_contour_first;
+ best_segment_first = prev;
- dist = FT_ABS( points[next].y - best_y );
- if ( dist > 5 )
- if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )
- break;
+ if ( FT_CURVE_TAG( outline.tags[prev] ) == FT_CURVE_TAG_ON )
+ {
+ best_on_point_first = prev;
+ if ( best_on_point_last < 0 )
+ best_on_point_last = prev;
+ }
- best_segment_last = next;
+ } while ( prev != best_point );
- if ( FT_CURVE_TAG( outline.tags[next] ) == FT_CURVE_TAG_ON )
+ do
{
- best_on_point_last = next;
- if ( best_on_point_first < 0 )
- best_on_point_first = next;
- }
+ if ( next < best_contour_last )
+ next++;
+ else
+ next = best_contour_first;
- } while ( next != best_point );
+ dist = FT_ABS( points[next].y - best_y );
+ if ( dist > 5 )
+ if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )
+ break;
- if ( AF_LATIN_IS_LONG_BLUE( bs ) )
- {
- /* If this flag is set, we have an additional constraint to */
- /* get the blue zone distance: Find a segment of the topmost */
- /* (or bottommost) contour that is longer than a heuristic */
- /* threshold. This ensures that small bumps in the outline */
- /* are ignored (for example, the `vertical serifs' found in */
- /* many Hebrew glyph designs). */
-
- /* If this segment is long enough, we are done. Otherwise, */
- /* search the segment next to the extremum that is long */
- /* enough, has the same direction, and a not too large */
- /* vertical distance from the extremum. Note that the */
- /* algorithm doesn't check whether the found segment is */
- /* actually the one (vertically) nearest to the extremum. */
-
- /* heuristic threshold value */
- FT_Pos length_threshold = metrics->units_per_em / 25;
-
-
- dist = FT_ABS( points[best_segment_last].x -
- points[best_segment_first].x );
-
- if ( dist < length_threshold &&
- best_segment_last - best_segment_first + 2 <=
- best_contour_last - best_contour_first )
+ best_segment_last = next;
+
+ if ( FT_CURVE_TAG( outline.tags[next] ) == FT_CURVE_TAG_ON )
+ {
+ best_on_point_last = next;
+ if ( best_on_point_first < 0 )
+ best_on_point_first = next;
+ }
+
+ } while ( next != best_point );
+
+ if ( AF_LATIN_IS_LONG_BLUE( bs ) )
{
+ /* If this flag is set, we have an additional constraint to */
+ /* get the blue zone distance: Find a segment of the topmost */
+ /* (or bottommost) contour that is longer than a heuristic */
+ /* threshold. This ensures that small bumps in the outline */
+ /* are ignored (for example, the `vertical serifs' found in */
+ /* many Hebrew glyph designs). */
+
+ /* If this segment is long enough, we are done. Otherwise, */
+ /* search the segment next to the extremum that is long */
+ /* enough, has the same direction, and a not too large */
+ /* vertical distance from the extremum. Note that the */
+ /* algorithm doesn't check whether the found segment is */
+ /* actually the one (vertically) nearest to the extremum. */
+
/* heuristic threshold value */
- FT_Pos height_threshold = metrics->units_per_em / 4;
+ FT_Pos length_threshold = metrics->units_per_em / 25;
- FT_Int first;
- FT_Int last;
- FT_Bool hit;
- /* we intentionally declare these two variables */
- /* outside of the loop since various compilers emit */
- /* incorrect warning messages otherwise, talking about */
- /* `possibly uninitialized variables' */
- FT_Int p_first = 0; /* make compiler happy */
- FT_Int p_last = 0;
+ dist = FT_ABS( points[best_segment_last].x -
+ points[best_segment_first].x );
- FT_Bool left2right;
+ if ( dist < length_threshold &&
+ best_segment_last - best_segment_first + 2 <=
+ best_contour_last - best_contour_first )
+ {
+ /* heuristic threshold value */
+ FT_Pos height_threshold = metrics->units_per_em / 4;
+ FT_Int first;
+ FT_Int last;
+ FT_Bool hit;
- /* compute direction */
- prev = best_point;
+ /* we intentionally declare these two variables */
+ /* outside of the loop since various compilers emit */
+ /* incorrect warning messages otherwise, talking about */
+ /* `possibly uninitialized variables' */
+ FT_Int p_first = 0; /* make compiler happy */
+ FT_Int p_last = 0;
- do
- {
- if ( prev > best_contour_first )
- prev--;
- else
- prev = best_contour_last;
+ FT_Bool left2right;
- if ( points[prev].x != best_x )
- break;
- } while ( prev != best_point );
+ /* compute direction */
+ prev = best_point;
- /* skip glyph for the degenerate case */
- if ( prev == best_point )
- continue;
+ do
+ {
+ if ( prev > best_contour_first )
+ prev--;
+ else
+ prev = best_contour_last;
- left2right = FT_BOOL( points[prev].x < points[best_point].x );
+ if ( points[prev].x != best_x )
+ break;
- first = best_segment_last;
- last = first;
- hit = 0;
+ } while ( prev != best_point );
- do
- {
- FT_Bool l2r;
- FT_Pos d;
+ /* skip glyph for the degenerate case */
+ if ( prev == best_point )
+ continue;
+ left2right = FT_BOOL( points[prev].x < points[best_point].x );
- if ( !hit )
+ first = best_segment_last;
+ last = first;
+ hit = 0;
+
+ do
{
- /* no hit; adjust first point */
- first = last;
+ FT_Bool l2r;
+ FT_Pos d;
- /* also adjust first and last on point */
- if ( FT_CURVE_TAG( outline.tags[first] ) ==
- FT_CURVE_TAG_ON )
- {
- p_first = first;
- p_last = first;
- }
- else
+
+ if ( !hit )
{
- p_first = -1;
- p_last = -1;
- }
+ /* no hit; adjust first point */
+ first = last;
- hit = 1;
- }
+ /* also adjust first and last on point */
+ if ( FT_CURVE_TAG( outline.tags[first] ) ==
+ FT_CURVE_TAG_ON )
+ {
+ p_first = first;
+ p_last = first;
+ }
+ else
+ {
+ p_first = -1;
+ p_last = -1;
+ }
- if ( last < best_contour_last )
- last++;
- else
- last = best_contour_first;
+ hit = 1;
+ }
- if ( FT_ABS( best_y - points[first].y ) > height_threshold )
- {
- /* vertical distance too large */
- hit = 0;
- continue;
- }
+ if ( last < best_contour_last )
+ last++;
+ else
+ last = best_contour_first;
- /* same test as above */
- dist = FT_ABS( points[last].y - points[first].y );
- if ( dist > 5 )
- if ( FT_ABS( points[last].x - points[first].x ) <=
- 20 * dist )
+ if ( FT_ABS( best_y - points[first].y ) > height_threshold )
{
+ /* vertical distance too large */
hit = 0;
continue;
}
- if ( FT_CURVE_TAG( outline.tags[last] ) == FT_CURVE_TAG_ON )
- {
- p_last = last;
- if ( p_first < 0 )
- p_first = last;
- }
+ /* same test as above */
+ dist = FT_ABS( points[last].y - points[first].y );
+ if ( dist > 5 )
+ if ( FT_ABS( points[last].x - points[first].x ) <=
+ 20 * dist )
+ {
+ hit = 0;
+ continue;
+ }
- l2r = FT_BOOL( points[first].x < points[last].x );
- d = FT_ABS( points[last].x - points[first].x );
+ if ( FT_CURVE_TAG( outline.tags[last] ) == FT_CURVE_TAG_ON )
+ {
+ p_last = last;
+ if ( p_first < 0 )
+ p_first = last;
+ }
- if ( l2r == left2right &&
- d >= length_threshold )
- {
- /* all constraints are met; update segment after finding */
- /* its end */
- do
+ l2r = FT_BOOL( points[first].x < points[last].x );
+ d = FT_ABS( points[last].x - points[first].x );
+
+ if ( l2r == left2right &&
+ d >= length_threshold )
{
- if ( last < best_contour_last )
- last++;
- else
- last = best_contour_first;
+ /* all constraints are met; update segment after */
+ /* finding its end */
+ do
+ {
+ if ( last < best_contour_last )
+ last++;
+ else
+ last = best_contour_first;
+
+ d = FT_ABS( points[last].y - points[first].y );
+ if ( d > 5 )
+ if ( FT_ABS( points[next].x - points[first].x ) <=
+ 20 * dist )
+ {
+ if ( last > best_contour_first )
+ last--;
+ else
+ last = best_contour_last;
+ break;
+ }
- d = FT_ABS( points[last].y - points[first].y );
- if ( d > 5 )
- if ( FT_ABS( points[next].x - points[first].x ) <=
- 20 * dist )
+ p_last = last;
+
+ if ( FT_CURVE_TAG( outline.tags[last] ) ==
+ FT_CURVE_TAG_ON )
{
- if ( last > best_contour_first )
- last--;
- else
- last = best_contour_last;
- break;
+ p_last = last;
+ if ( p_first < 0 )
+ p_first = last;
}
- p_last = last;
+ } while ( last != best_segment_first );
- if ( FT_CURVE_TAG( outline.tags[last] ) ==
- FT_CURVE_TAG_ON )
- {
- p_last = last;
- if ( p_first < 0 )
- p_first = last;
- }
+ best_y = points[first].y;
+
+ best_segment_first = first;
+ best_segment_last = last;
+
+ best_on_point_first = p_first;
+ best_on_point_last = p_last;
- } while ( last != best_segment_first );
+ break;
+ }
- best_y = points[first].y;
+ } while ( last != best_segment_first );
+ }
+ }
- best_segment_first = first;
- best_segment_last = last;
+ /* for computing blue zones, we add the y offset as returned */
+ /* by the currently used OpenType feature -- for example, */
+ /* superscript glyphs might be identical to subscript glyphs */
+ /* with a vertical shift */
+ best_y += y_offset;
- best_on_point_first = p_first;
- best_on_point_last = p_last;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( num_idx == 1 )
+ FT_TRACE5(( " U+%04lX: best_y = %5ld", ch, best_y ));
+ else
+ FT_TRACE5(( " component %d of cluster starting with U+%04lX:"
+ " best_y = %5ld", i, ch, best_y ));
+#endif
- break;
- }
+ /* now set the `round' flag depending on the segment's kind: */
+ /* */
+ /* - if the horizontal distance between the first and last */
+ /* `on' point is larger than a heuristic threshold */
+ /* we have a flat segment */
+ /* - if either the first or the last point of the segment is */
+ /* an `off' point, the segment is round, otherwise it is */
+ /* flat */
+ if ( best_on_point_first >= 0 &&
+ best_on_point_last >= 0 &&
+ ( FT_ABS( points[best_on_point_last].x -
+ points[best_on_point_first].x ) ) >
+ flat_threshold )
+ round = 0;
+ else
+ round = FT_BOOL(
+ FT_CURVE_TAG( outline.tags[best_segment_first] ) !=
+ FT_CURVE_TAG_ON ||
+ FT_CURVE_TAG( outline.tags[best_segment_last] ) !=
+ FT_CURVE_TAG_ON );
- } while ( last != best_segment_first );
+ if ( round && AF_LATIN_IS_NEUTRAL_BLUE( bs ) )
+ {
+ /* only use flat segments for a neutral blue zone */
+ FT_TRACE5(( " (round, skipped)\n" ));
+ continue;
}
+
+ FT_TRACE5(( " (%s)\n", round ? "round" : "flat" ));
}
- /* for computing blue zones, we add the y offset as returned */
- /* by the currently used OpenType feature -- for example, */
- /* superscript glyphs might be identical to subscript glyphs */
- /* with a vertical shift */
- best_y += y_offset;
-
- FT_TRACE5(( " U+%04lX: best_y = %5ld", ch, best_y ));
-
- /* now set the `round' flag depending on the segment's kind: */
- /* */
- /* - if the horizontal distance between the first and last */
- /* `on' point is larger than upem/8 (value 8 is heuristic) */
- /* we have a flat segment */
- /* - if either the first or the last point of the segment is */
- /* an `off' point, the segment is round, otherwise it is */
- /* flat */
- if ( best_on_point_first >= 0 &&
- best_on_point_last >= 0 &&
- (FT_UInt)( FT_ABS( points[best_on_point_last].x -
- points[best_on_point_first].x ) ) >
- metrics->units_per_em / 8 )
- round = 0;
+ if ( AF_LATIN_IS_TOP_BLUE( bs ) )
+ {
+ if ( best_y > best_y_extremum )
+ {
+ best_y_extremum = best_y;
+ best_round = round;
+ }
+ }
else
- round = FT_BOOL(
- FT_CURVE_TAG( outline.tags[best_segment_first] ) !=
- FT_CURVE_TAG_ON ||
- FT_CURVE_TAG( outline.tags[best_segment_last] ) !=
- FT_CURVE_TAG_ON );
-
- if ( round && AF_LATIN_IS_NEUTRAL_BLUE( bs ) )
{
- /* only use flat segments for a neutral blue zone */
- FT_TRACE5(( " (round, skipped)\n" ));
- continue;
+ if ( best_y < best_y_extremum )
+ {
+ best_y_extremum = best_y;
+ best_round = round;
+ }
}
- FT_TRACE5(( " (%s)\n", round ? "round" : "flat" ));
+ } /* end for loop */
+
+ if ( !( best_y_extremum == FT_INT_MIN ||
+ best_y_extremum == FT_INT_MAX ) )
+ {
+ if ( best_round )
+ rounds[num_rounds++] = best_y_extremum;
+ else
+ flats[num_flats++] = best_y_extremum;
}
- if ( round )
- rounds[num_rounds++] = best_y;
- else
- flats[num_flats++] = best_y;
- }
+ } /* end while loop */
if ( num_flats == 0 && num_rounds == 0 )
{
@@ -775,7 +890,8 @@
FT_Bool over_ref = FT_BOOL( shoot > ref );
- if ( AF_LATIN_IS_TOP_BLUE( bs ) ^ over_ref )
+ if ( ( AF_LATIN_IS_TOP_BLUE( bs ) ||
+ AF_LATIN_IS_SUB_TOP_BLUE( bs) ) ^ over_ref )
{
*blue_ref =
*blue_shoot = ( shoot + ref ) / 2;
@@ -785,9 +901,14 @@
}
}
+ blue->ascender = ascender;
+ blue->descender = descender;
+
blue->flags = 0;
if ( AF_LATIN_IS_TOP_BLUE( bs ) )
blue->flags |= AF_LATIN_BLUE_TOP;
+ if ( AF_LATIN_IS_SUB_TOP_BLUE( bs ) )
+ blue->flags |= AF_LATIN_BLUE_SUB_TOP;
if ( AF_LATIN_IS_NEUTRAL_BLUE( bs ) )
blue->flags |= AF_LATIN_BLUE_NEUTRAL;
@@ -802,7 +923,10 @@
FT_TRACE5(( " -> reference = %ld\n"
" overshoot = %ld\n",
*blue_ref, *blue_shoot ));
- }
+
+ } /* end for loop */
+
+ af_shaper_buf_destroy( face, shaper_buf );
FT_TRACE5(( "\n" ));
@@ -816,27 +940,36 @@
af_latin_metrics_check_digits( AF_LatinMetrics metrics,
FT_Face face )
{
- FT_UInt i;
FT_Bool started = 0, same_width = 1;
FT_Fixed advance, old_advance = 0;
+ void* shaper_buf;
- /* digit `0' is 0x30 in all supported charmaps */
- for ( i = 0x30; i <= 0x39; i++ )
+ /* in all supported charmaps, digits have character codes 0x30-0x39 */
+ const char digits[] = "0 1 2 3 4 5 6 7 8 9";
+ const char* p;
+
+
+ p = digits;
+ shaper_buf = af_shaper_buf_create( face );
+
+ while ( *p )
{
- FT_ULong glyph_index;
- FT_Long y_offset;
+ FT_ULong glyph_index;
+ unsigned int num_idx;
- af_get_char_index( &metrics->root, i, &glyph_index, &y_offset );
- if ( glyph_index == 0 )
+ /* reject input that maps to more than a single glyph */
+ p = af_shaper_get_cluster( p, &metrics->root, shaper_buf, &num_idx );
+ if ( num_idx > 1 )
continue;
- if ( FT_Get_Advance( face, glyph_index,
- FT_LOAD_NO_SCALE |
- FT_LOAD_NO_HINTING |
- FT_LOAD_IGNORE_TRANSFORM,
- &advance ) )
+ glyph_index = af_shaper_get_elem( &metrics->root,
+ shaper_buf,
+ 0,
+ &advance,
+ NULL );
+ if ( !glyph_index )
continue;
if ( started )
@@ -854,6 +987,8 @@
}
}
+ af_shaper_buf_destroy( face, shaper_buf );
+
metrics->root.digits_have_same_width = same_width;
}
@@ -967,18 +1102,52 @@
#endif
if ( dim == AF_DIMENSION_VERT )
{
- scale = FT_MulDiv( scale, fitted, scaled );
-
- FT_TRACE5((
- "af_latin_metrics_scale_dim:"
- " x height alignment (style `%s'):\n"
- " "
- " vertical scaling changed from %.4f to %.4f (by %d%%)\n"
- "\n",
- af_style_names[metrics->root.style_class->style],
- axis->org_scale / 65536.0,
- scale / 65536.0,
- ( fitted - scaled ) * 100 / scaled ));
+ FT_Pos max_height;
+ FT_Pos dist;
+ FT_Fixed new_scale;
+
+
+ new_scale = FT_MulDiv( scale, fitted, scaled );
+
+ /* the scaling should not change the result by more than two pixels */
+ max_height = metrics->units_per_em;
+
+ for ( nn = 0; nn < Axis->blue_count; nn++ )
+ {
+ max_height = FT_MAX( max_height, Axis->blues[nn].ascender );
+ max_height = FT_MAX( max_height, -Axis->blues[nn].descender );
+ }
+
+ dist = FT_ABS( FT_MulFix( max_height, new_scale - scale ) );
+ dist &= ~127;
+
+ if ( dist == 0 )
+ {
+ scale = new_scale;
+
+ FT_TRACE5((
+ "af_latin_metrics_scale_dim:"
+ " x height alignment (style `%s'):\n"
+ " "
+ " vertical scaling changed from %.4f to %.4f (by %d%%)\n"
+ "\n",
+ af_style_names[metrics->root.style_class->style],
+ axis->org_scale / 65536.0,
+ scale / 65536.0,
+ ( fitted - scaled ) * 100 / scaled ));
+ }
+#ifdef FT_DEBUG_LEVEL_TRACE
+ else
+ {
+ FT_TRACE5((
+ "af_latin_metrics_scale_dim:"
+ " x height alignment (style `%s'):\n"
+ " "
+ " excessive vertical scaling abandoned\n"
+ "\n",
+ af_style_names[metrics->root.style_class->style] ));
+ }
+#endif
}
}
}
@@ -1032,8 +1201,11 @@
if ( dim == AF_DIMENSION_VERT )
{
- FT_TRACE5(( "blue zones (style `%s')\n",
- af_style_names[metrics->root.style_class->style] ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( axis->blue_count )
+ FT_TRACE5(( "blue zones (style `%s')\n",
+ af_style_names[metrics->root.style_class->style] ));
+#endif
/* scale the blue zones */
for ( nn = 0; nn < axis->blue_count; nn++ )
@@ -1106,21 +1278,63 @@
#endif
blue->flags |= AF_LATIN_BLUE_ACTIVE;
+ }
+ }
+
+ /* use sub-top blue zone only if it doesn't overlap with */
+ /* another (non-sup-top) blue zone; otherwise, the */
+ /* effect would be similar to a neutral blue zone, which */
+ /* is not desired here */
+ for ( nn = 0; nn < axis->blue_count; nn++ )
+ {
+ AF_LatinBlue blue = &axis->blues[nn];
+ FT_UInt i;
+
+
+ if ( !( blue->flags & AF_LATIN_BLUE_SUB_TOP ) )
+ continue;
+ if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) )
+ continue;
- FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n"
- " overshoot %d: %d scaled to %.2f%s\n",
- nn,
- blue->ref.org,
- blue->ref.fit / 64.0,
- blue->flags & AF_LATIN_BLUE_ACTIVE ? ""
- : " (inactive)",
- nn,
- blue->shoot.org,
- blue->shoot.fit / 64.0,
- blue->flags & AF_LATIN_BLUE_ACTIVE ? ""
- : " (inactive)" ));
+ for ( i = 0; i < axis->blue_count; i++ )
+ {
+ AF_LatinBlue b = &axis->blues[i];
+
+
+ if ( b->flags & AF_LATIN_BLUE_SUB_TOP )
+ continue;
+ if ( !( b->flags & AF_LATIN_BLUE_ACTIVE ) )
+ continue;
+
+ if ( b->ref.fit <= blue->shoot.fit &&
+ b->shoot.fit >= blue->ref.fit )
+ {
+ blue->flags &= ~AF_LATIN_BLUE_ACTIVE;
+ break;
+ }
}
}
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ for ( nn = 0; nn < axis->blue_count; nn++ )
+ {
+ AF_LatinBlue blue = &axis->blues[nn];
+
+
+ FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n"
+ " overshoot %d: %d scaled to %.2f%s\n",
+ nn,
+ blue->ref.org,
+ blue->ref.fit / 64.0,
+ blue->flags & AF_LATIN_BLUE_ACTIVE ? ""
+ : " (inactive)",
+ nn,
+ blue->shoot.org,
+ blue->shoot.fit / 64.0,
+ blue->flags & AF_LATIN_BLUE_ACTIVE ? ""
+ : " (inactive)" ));
+ }
+#endif
}
}
@@ -1140,6 +1354,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;
+ }
+
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -1155,14 +1385,17 @@
af_latin_hints_compute_segments( AF_GlyphHints hints,
AF_Dimension dim )
{
- AF_AxisHints axis = &hints->axis[dim];
- FT_Memory memory = hints->memory;
- FT_Error error = FT_Err_Ok;
- AF_Segment segment = NULL;
- AF_SegmentRec seg0;
- AF_Point* contour = hints->contours;
- AF_Point* contour_limit = contour + hints->num_contours;
- AF_Direction major_dir, segment_dir;
+ AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics;
+ AF_AxisHints axis = &hints->axis[dim];
+ FT_Memory memory = hints->memory;
+ FT_Error error = FT_Err_Ok;
+ AF_Segment segment = NULL;
+ AF_SegmentRec seg0;
+ AF_Point* contour = hints->contours;
+ AF_Point* contour_limit = contour + hints->num_contours;
+ AF_Direction major_dir, segment_dir;
+
+ FT_Pos flat_threshold = FLAT_THRESHOLD( metrics->units_per_em );
FT_ZERO( &seg0 );
@@ -1203,11 +1436,13 @@
/* do each contour separately */
for ( ; contour < contour_limit; contour++ )
{
- AF_Point point = contour[0];
- AF_Point last = point->prev;
- int on_edge = 0;
- FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */
- FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */
+ AF_Point point = contour[0];
+ AF_Point last = point->prev;
+ int on_edge = 0;
+ FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */
+ FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */
+ FT_Pos min_on_pos = 32000;
+ FT_Pos max_on_pos = -32000;
FT_Bool passed;
@@ -1249,6 +1484,16 @@
if ( u > max_pos )
max_pos = u;
+ /* get minimum and maximum coordinate of on points */
+ if ( !( point->flags & AF_FLAG_CONTROL ) )
+ {
+ v = point->v;
+ if ( v < min_on_pos )
+ min_on_pos = v;
+ if ( v > max_on_pos )
+ max_on_pos = v;
+ }
+
if ( point->out_dir != segment_dir || point == last )
{
/* we are just leaving an edge; record a new segment! */
@@ -1256,9 +1501,10 @@
segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 );
/* a segment is round if either its first or last point */
- /* is a control point */
- if ( ( segment->first->flags | point->flags ) &
- AF_FLAG_CONTROL )
+ /* is a control point, and the length of the on points */
+ /* inbetween doesn't exceed a heuristic limit */
+ if ( ( segment->first->flags | point->flags ) & AF_FLAG_CONTROL &&
+ ( max_on_pos - min_on_pos ) < flat_threshold )
segment->flags |= AF_EDGE_ROUND;
/* compute segment size */
@@ -1301,10 +1547,19 @@
/* clear all segment fields */
segment[0] = seg0;
- segment->dir = (FT_Char)segment_dir;
+ segment->dir = (FT_Char)segment_dir;
+ segment->first = point;
+ segment->last = point;
+
min_pos = max_pos = point->u;
- segment->first = point;
- segment->last = point;
+
+ if ( point->flags & AF_FLAG_CONTROL )
+ {
+ min_on_pos = 32000;
+ max_on_pos = -32000;
+ }
+ else
+ min_on_pos = max_on_pos = point->v;
on_edge = 1;
}
@@ -1872,7 +2127,8 @@
/* the major direction) -- this assumes the TrueType convention */
/* for the orientation of contours */
is_top_blue =
- (FT_Byte)( ( blue->flags & AF_LATIN_BLUE_TOP ) != 0 );
+ (FT_Byte)( ( blue->flags & ( AF_LATIN_BLUE_TOP |
+ AF_LATIN_BLUE_SUB_TOP ) ) != 0 );
is_neutral_blue =
(FT_Byte)( ( blue->flags & AF_LATIN_BLUE_NEUTRAL ) != 0);
is_major_dir =
@@ -2805,7 +3061,8 @@
/* Apply the complete hinting algorithm to a latin glyph. */
static FT_Error
- af_latin_hints_apply( AF_GlyphHints hints,
+ af_latin_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_LatinMetrics metrics )
{
@@ -2847,7 +3104,9 @@
if ( error )
goto Exit;
- af_latin_hints_compute_blue_edges( hints, metrics );
+ /* apply blue zones to base characters only */
+ if ( !( metrics->root.globals->glyph_styles[glyph_index] & AF_NONBASE ) )
+ af_latin_hints_compute_blue_edges( hints, metrics );
}
/* grid-fit the outline */
@@ -2907,6 +3166,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
diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h
index 6855492..414060f 100644
--- a/src/autofit/aflatin.h
+++ b/src/autofit/aflatin.h
@@ -53,6 +53,8 @@ FT_BEGIN_HEADER
#define AF_LATIN_IS_TOP_BLUE( b ) \
( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP )
+#define AF_LATIN_IS_SUB_TOP_BLUE( b ) \
+ ( (b)->properties & AF_BLUE_PROPERTY_LATIN_SUB_TOP )
#define AF_LATIN_IS_NEUTRAL_BLUE( b ) \
( (b)->properties & AF_BLUE_PROPERTY_LATIN_NEUTRAL )
#define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \
@@ -65,8 +67,10 @@ FT_BEGIN_HEADER
#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */
-#define AF_LATIN_BLUE_NEUTRAL ( 1U << 2 ) /* we have neutral blue zone */
-#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 3 ) /* used for scale adjustment */
+#define AF_LATIN_BLUE_SUB_TOP ( 1U << 2 ) /* we have a subscript top */
+ /* blue zone */
+#define AF_LATIN_BLUE_NEUTRAL ( 1U << 3 ) /* we have neutral blue zone */
+#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 4 ) /* used for scale adjustment */
/* optimization */
@@ -74,6 +78,8 @@ FT_BEGIN_HEADER
{
AF_WidthRec ref;
AF_WidthRec shoot;
+ FT_Pos ascender;
+ FT_Pos descender;
FT_UInt flags;
} AF_LatinBlueRec, *AF_LatinBlue;
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index ac9f933..2fb7d1d 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -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;
+ }
+
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -2300,13 +2316,16 @@
static FT_Error
- af_latin2_hints_apply( AF_GlyphHints hints,
+ af_latin2_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_LatinMetrics metrics )
{
FT_Error error;
int dim;
+ FT_UNUSED( glyph_index );
+
error = af_glyph_hints_reload( hints, outline );
if ( error )
@@ -2389,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
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 7c2fa7c..aa5b8fd 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -23,6 +23,8 @@
#include "afmodule.h"
#include "afpic.h"
+#include FT_INTERNAL_CALC_H
+
/* Initialize glyph loader. */
@@ -76,6 +78,14 @@
}
+#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 ) )
+
+
/* 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. */
@@ -88,6 +98,8 @@
FT_UInt glyph_index,
FT_Int32 load_flags )
{
+ AF_Module module = loader->globals->module;
+
FT_Error error;
FT_Face face = loader->face;
AF_StyleMetrics metrics = loader->metrics;
@@ -103,6 +115,132 @@
if ( error )
goto Exit;
+ /*
+ * Apply stem darkening (emboldening) here before hints are applied to
+ * the outline. Glyphs are scaled down proportionally to the
+ * emboldening so that curve points don't fall outside their precomputed
+ * blue zones.
+ *
+ * Any emboldening done by the font driver (e.g., the CFF driver)
+ * doesn't reach here because the autohinter loads the unprocessed
+ * glyphs in font units for analysis (functions `af_*_metrics_init_*')
+ * and then above to prepare it for the rasterizers by itself,
+ * independently of the font driver. So emboldening must be done here,
+ * within the autohinter.
+ *
+ * All glyphs to be autohinted pass through here one by one. The
+ * standard widths can therefore change from one glyph to the next,
+ * depending on what script a glyph is assigned to (each script has its
+ * own set of standard widths and other metrics). The darkening amount
+ * must therefore be recomputed for each size and
+ * `standard_{vertical,horizontal}_width' change.
+ */
+ if ( !module->no_stem_darkening )
+ {
+ AF_FaceGlobals globals = loader->globals;
+ AF_WritingSystemClass writing_system_class;
+
+ FT_Pos stdVW = 0;
+ FT_Pos stdHW = 0;
+
+ FT_Bool size_changed = face->size->metrics.x_ppem
+ != globals->stem_darkening_for_ppem;
+
+ FT_Fixed em_size = af_intToFixed( face->units_per_EM );
+ FT_Fixed em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size );
+
+ FT_Matrix scale_down_matrix = { 0x10000L, 0, 0, 0x10000L };
+
+
+ /* Skip stem darkening for broken fonts. */
+ if ( !face->units_per_EM )
+ goto After_Emboldening;
+
+ /*
+ * We depend on the writing system (script analyzers) to supply
+ * standard widths for the script of the glyph we are looking at. If
+ * it can't deliver, stem darkening is effectively disabled.
+ */
+ writing_system_class =
+ AF_WRITING_SYSTEM_CLASSES_GET[metrics->style_class->writing_system];
+
+ if ( writing_system_class->style_metrics_getstdw )
+ writing_system_class->style_metrics_getstdw( metrics,
+ &stdHW,
+ &stdVW );
+ else
+ goto After_Emboldening;
+
+
+ if ( size_changed ||
+ ( stdVW > 0 && stdVW != globals->standard_vertical_width ) )
+ {
+ FT_Fixed darken_by_font_units_x, darken_x;
+
+
+ darken_by_font_units_x =
+ af_intToFixed( af_loader_compute_darkening( loader,
+ face,
+ stdVW ) );
+ darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x,
+ face->size->metrics.x_scale ),
+ em_ratio );
+
+ globals->standard_vertical_width = stdVW;
+ globals->stem_darkening_for_ppem = face->size->metrics.x_ppem;
+ globals->darken_x = af_fixedToInt( darken_x );
+ }
+
+ if ( size_changed ||
+ ( stdHW > 0 && stdHW != globals->standard_horizontal_width ) )
+ {
+ FT_Fixed darken_by_font_units_y, darken_y;
+
+
+ darken_by_font_units_y =
+ af_intToFixed( af_loader_compute_darkening( loader,
+ face,
+ stdHW ) );
+ darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y,
+ face->size->metrics.y_scale ),
+ em_ratio );
+
+ globals->standard_horizontal_width = stdHW;
+ globals->stem_darkening_for_ppem = face->size->metrics.x_ppem;
+ globals->darken_y = af_fixedToInt( darken_y );
+
+ /*
+ * Scale outlines down on the Y-axis to keep them inside their blue
+ * zones. The stronger the emboldening, the stronger the
+ * downscaling (plus heuristical padding to prevent outlines still
+ * falling out their zones due to rounding).
+ *
+ * Reason: `FT_Outline_Embolden' works by shifting the rightmost
+ * points of stems farther to the right, and topmost points farther
+ * up. This positions points on the Y-axis outside their
+ * pre-computed blue zones and leads to distortion when applying the
+ * hints in the code further below. Code outside this emboldening
+ * block doesn't know we are presenting it with modified outlines
+ * the analyzer didn't see!
+ *
+ * An unfortunate side effect of downscaling is that the emboldening
+ * effect is slightly decreased. The loss becomes more pronounced
+ * versus the CFF driver at smaller sizes, e.g., at 9ppem and below.
+ */
+ globals->scale_down_factor =
+ FT_DivFix( em_size - ( darken_by_font_units_y + af_intToFixed( 8 ) ),
+ em_size );
+ }
+
+ FT_Outline_EmboldenXY( &slot->outline,
+ globals->darken_x,
+ globals->darken_y );
+
+ scale_down_matrix.yy = globals->scale_down_factor;
+ FT_Outline_Transform( &slot->outline, &scale_down_matrix );
+ }
+
+ After_Emboldening:
loader->transformed = internal->glyph_transformed;
if ( loader->transformed )
{
@@ -150,7 +288,8 @@
if ( writing_system_class->style_hints_apply )
- writing_system_class->style_hints_apply( hints,
+ writing_system_class->style_hints_apply( glyph_index,
+ hints,
&gloader->base.outline,
metrics );
}
@@ -404,4 +543,134 @@
}
+ /*
+ * 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?
+ */
+ 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 ) );
+ }
+
+
/* END */
diff --git a/src/autofit/afloader.h b/src/autofit/afloader.h
index 37cfd14..4c4affc 100644
--- a/src/autofit/afloader.h
+++ b/src/autofit/afloader.h
@@ -75,6 +75,11 @@ FT_BEGIN_HEADER
FT_UInt gindex,
FT_Int32 load_flags );
+ FT_LOCAL_DEF( FT_Int32 )
+ af_loader_compute_darkening( AF_Loader loader,
+ FT_Face face,
+ FT_Pos standard_width );
+
/* */
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 8ae425c..45fd360 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -25,6 +25,10 @@
#ifdef FT_DEBUG_AUTOFIT
#ifndef FT_MAKE_OPTION_SINGLE_OBJECT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
extern void
af_glyph_hints_dump_segments( AF_GlyphHints hints,
FT_Bool to_stdout );
@@ -34,6 +38,10 @@
extern void
af_glyph_hints_dump_edges( AF_GlyphHints hints,
FT_Bool to_stdout );
+#ifdef __cplusplus
+ }
+#endif
+
#endif
int _af_debug_disable_horz_hints;
@@ -169,6 +177,46 @@
return error;
}
#endif /* AF_CONFIG_OPTION_USE_WARPER */
+ else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
+ {
+ FT_Int* darken_params = (FT_Int*)value;
+
+ FT_Int x1 = darken_params[0];
+ FT_Int y1 = darken_params[1];
+ FT_Int x2 = darken_params[2];
+ FT_Int y2 = darken_params[3];
+ FT_Int x3 = darken_params[4];
+ FT_Int y3 = darken_params[5];
+ FT_Int x4 = darken_params[6];
+ FT_Int y4 = darken_params[7];
+
+
+ if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
+ y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
+ x1 > x2 || x2 > x3 || x3 > x4 ||
+ y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
+ return FT_THROW( Invalid_Argument );
+
+ module->darken_params[0] = x1;
+ module->darken_params[1] = y1;
+ module->darken_params[2] = x2;
+ module->darken_params[3] = y2;
+ module->darken_params[4] = x3;
+ module->darken_params[5] = y3;
+ module->darken_params[6] = x4;
+ module->darken_params[7] = y4;
+
+ return error;
+ }
+ else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
+ {
+ FT_Bool* no_stem_darkening = (FT_Bool*)value;
+
+
+ module->no_stem_darkening = *no_stem_darkening;
+
+ return error;
+ }
FT_TRACE0(( "af_property_set: missing property `%s'\n",
property_name ));
@@ -245,6 +293,33 @@
return error;
}
#endif /* AF_CONFIG_OPTION_USE_WARPER */
+ else if ( !ft_strcmp( property_name, "darkening-parameters" ) )
+ {
+ FT_Int* darken_params = module->darken_params;
+ FT_Int* val = (FT_Int*)value;
+
+
+ val[0] = darken_params[0];
+ val[1] = darken_params[1];
+ val[2] = darken_params[2];
+ val[3] = darken_params[3];
+ val[4] = darken_params[4];
+ val[5] = darken_params[5];
+ val[6] = darken_params[6];
+ val[7] = darken_params[7];
+
+ return error;
+ }
+ else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
+ {
+ FT_Bool no_stem_darkening = module->no_stem_darkening;
+ FT_Bool* val = (FT_Bool*)value;
+
+
+ *val = no_stem_darkening;
+
+ return error;
+ }
FT_TRACE0(( "af_property_get: missing property `%s'\n",
property_name ));
@@ -254,8 +329,8 @@
FT_DEFINE_SERVICE_PROPERTIESREC(
af_service_properties,
- (FT_Properties_SetFunc)af_property_set,
- (FT_Properties_GetFunc)af_property_get )
+ (FT_Properties_SetFunc)af_property_set, /* set_property */
+ (FT_Properties_GetFunc)af_property_get ) /* get_property */
FT_DEFINE_SERVICEDESCREC1(
@@ -291,11 +366,21 @@
AF_Module module = (AF_Module)ft_module;
- module->fallback_style = AF_STYLE_FALLBACK;
- module->default_script = AF_SCRIPT_DEFAULT;
+ module->fallback_style = AF_STYLE_FALLBACK;
+ module->default_script = AF_SCRIPT_DEFAULT;
#ifdef AF_CONFIG_OPTION_USE_WARPER
- module->warping = 0;
+ module->warping = 0;
#endif
+ module->no_stem_darkening = TRUE;
+
+ module->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
+ module->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
+ module->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
+ module->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
+ module->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
+ module->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
+ module->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
+ module->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
return FT_Err_Ok;
}
diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h
index b9c2fd8..3c61d89 100644
--- a/src/autofit/afmodule.h
+++ b/src/autofit/afmodule.h
@@ -41,6 +41,8 @@ FT_BEGIN_HEADER
#ifdef AF_CONFIG_OPTION_USE_WARPER
FT_Bool warping;
#endif
+ FT_Bool no_stem_darkening;
+ FT_Int darken_params[8];
} AF_ModuleRec, *AF_Module;
diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c
index 5589e61..37254a2 100644
--- a/src/autofit/afpic.c
+++ b/src/autofit/afpic.c
@@ -122,7 +122,7 @@
#include "afwrtsys.h"
#undef SCRIPT
-#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \
+#define SCRIPT( s, S, d, h, sss ) \
FT_Init_Class_af_ ## s ## _script_class( \
&container->af_script_classes_rec[ss++] );
diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h
index 25071e3..9b45069 100644
--- a/src/autofit/afpic.h
+++ b/src/autofit/afpic.h
@@ -20,8 +20,6 @@
#define __AFPIC_H__
-FT_BEGIN_HEADER
-
#include FT_INTERNAL_PIC_H
@@ -43,6 +41,8 @@ FT_BEGIN_HEADER
#include "aftypes.h"
+FT_BEGIN_HEADER
+
typedef struct AFModulePIC_
{
FT_ServiceDescRec* af_services;
@@ -93,12 +93,12 @@ FT_BEGIN_HEADER
FT_Error
autofit_module_class_pic_init( FT_Library library );
+FT_END_HEADER
+
#endif /* FT_CONFIG_OPTION_PIC */
/* */
-FT_END_HEADER
-
#endif /* __AFPIC_H__ */
diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c
index c1e0afb..cf8bb7c 100644
--- a/src/autofit/afranges.c
+++ b/src/autofit/afranges.c
@@ -18,6 +18,43 @@
#include "afranges.h"
+ /*
+ * The algorithm for assigning properties and styles to the `glyph_styles'
+ * array is as follows (cf. the implementation in
+ * `af_face_globals_compute_style_coverage').
+ *
+ * Walk over all scripts (as listed in `afscript.h').
+ *
+ * For a given script, walk over all styles (as listed in `afstyles.h').
+ * The order of styles is important and should be as follows.
+ *
+ * - First come styles based on OpenType features (small caps, for
+ * example). Since features rely on glyph indices, thus completely
+ * bypassing character codes, no properties are assigned.
+ *
+ * - Next comes the default style, using the character ranges as defined
+ * below. This also assigns properties.
+ *
+ * Note that there also exist fallback scripts, mainly covering
+ * superscript and subscript glyphs of a script that are not present as
+ * OpenType features. Fallback scripts are defined below, also
+ * assigning properties; they are applied after the corresponding
+ * script.
+ *
+ */
+
+
+ /* XXX Check base character ranges again: */
+ /* Right now, they are quickly derived by visual inspection. */
+ /* I can imagine that fine-tuning is necessary. */
+
+ /* for the auto-hinter, a `non-base character' is something that should */
+ /* not be affected by blue zones, regardless of whether this is a */
+ /* spacing or no-spacing glyph */
+
+ /* the `ta_xxxx_nonbase_uniranges' ranges must be strict subsets */
+ /* of the corresponding `ta_xxxx_uniranges' ranges */
+
const AF_Script_UniRangeRec af_arab_uniranges[] =
{
@@ -30,6 +67,30 @@
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_arab_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0600UL, 0x0605UL ),
+ AF_UNIRANGE_REC( 0x0610UL, 0x061AUL ),
+ AF_UNIRANGE_REC( 0x064BUL, 0x065FUL ),
+ AF_UNIRANGE_REC( 0x0670UL, 0x0670UL ),
+ AF_UNIRANGE_REC( 0x06D6UL, 0x06DCUL ),
+ AF_UNIRANGE_REC( 0x06DFUL, 0x06E4UL ),
+ AF_UNIRANGE_REC( 0x06E7UL, 0x06E8UL ),
+ AF_UNIRANGE_REC( 0x06EAUL, 0x06EDUL ),
+ AF_UNIRANGE_REC( 0x08E3UL, 0x08FFUL ),
+ AF_UNIRANGE_REC( 0xFBB2UL, 0xFBC1UL ),
+ AF_UNIRANGE_REC( 0xFE70UL, 0xFE70UL ),
+ AF_UNIRANGE_REC( 0xFE72UL, 0xFE72UL ),
+ AF_UNIRANGE_REC( 0xFE74UL, 0xFE74UL ),
+ AF_UNIRANGE_REC( 0xFE76UL, 0xFE76UL ),
+ AF_UNIRANGE_REC( 0xFE78UL, 0xFE78UL ),
+ AF_UNIRANGE_REC( 0xFE7AUL, 0xFE7AUL ),
+ AF_UNIRANGE_REC( 0xFE7CUL, 0xFE7CUL ),
+ AF_UNIRANGE_REC( 0xFE7EUL, 0xFE7EUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_cyrl_uniranges[] =
{
AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */
@@ -39,23 +100,47 @@
AF_UNIRANGE_REC( 0UL, 0UL )
};
- /* there are some characters in the Devanagari Unicode block that are */
+ const AF_Script_UniRangeRec af_cyrl_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0483UL, 0x0489UL ),
+ AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ),
+ AF_UNIRANGE_REC( 0xA66FUL, 0xA67FUL ),
+ AF_UNIRANGE_REC( 0xA69EUL, 0xA69FUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ /* There are some characters in the Devanagari Unicode block that are */
/* generic to Indic scripts; we omit them so that their presence doesn't */
- /* trigger Devanagari */
+ /* trigger Devanagari. */
const AF_Script_UniRangeRec af_deva_uniranges[] =
{
- AF_UNIRANGE_REC( 0x0900UL, 0x093BUL ), /* Devanagari */
+ AF_UNIRANGE_REC( 0x0900UL, 0x093BUL ), /* Devanagari */
/* omitting U+093C nukta */
- AF_UNIRANGE_REC( 0x093DUL, 0x0950UL ),
+ AF_UNIRANGE_REC( 0x093DUL, 0x0950UL ), /* ... continued */
/* omitting U+0951 udatta, U+0952 anudatta */
- AF_UNIRANGE_REC( 0x0953UL, 0x0963UL ),
+ AF_UNIRANGE_REC( 0x0953UL, 0x0963UL ), /* ... continued */
/* omitting U+0964 danda, U+0965 double danda */
- AF_UNIRANGE_REC( 0x0966UL, 0x097FUL ),
- AF_UNIRANGE_REC( 0x20B9UL, 0x20B9UL ), /* (new) Rupee sign */
+ AF_UNIRANGE_REC( 0x0966UL, 0x097FUL ), /* ... continued */
+ AF_UNIRANGE_REC( 0x20B9UL, 0x20B9UL ), /* (new) Rupee sign */
+ AF_UNIRANGE_REC( 0xA8E0UL, 0xA8FFUL ), /* Devanagari Extended */
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_deva_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0900UL, 0x0902UL ),
+ AF_UNIRANGE_REC( 0x093AUL, 0x093AUL ),
+ AF_UNIRANGE_REC( 0x0941UL, 0x0948UL ),
+ AF_UNIRANGE_REC( 0x094DUL, 0x094DUL ),
+ AF_UNIRANGE_REC( 0x0953UL, 0x0957UL ),
+ AF_UNIRANGE_REC( 0x0962UL, 0x0963UL ),
+ AF_UNIRANGE_REC( 0xA8E0UL, 0xA8F1UL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_grek_uniranges[] =
{
AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */
@@ -63,6 +148,19 @@
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_grek_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x037AUL, 0x037AUL ),
+ AF_UNIRANGE_REC( 0x0384UL, 0x0385UL ),
+ AF_UNIRANGE_REC( 0x1FBDUL, 0x1FC1UL ),
+ AF_UNIRANGE_REC( 0x1FCDUL, 0x1FCFUL ),
+ AF_UNIRANGE_REC( 0x1FDDUL, 0x1FDFUL ),
+ AF_UNIRANGE_REC( 0x1FEDUL, 0x1FEFUL ),
+ AF_UNIRANGE_REC( 0x1FFDUL, 0x1FFEUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_hebr_uniranges[] =
{
AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */
@@ -70,51 +168,225 @@
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_hebr_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0591UL, 0x05BFUL ),
+ AF_UNIRANGE_REC( 0x05C1UL, 0x05C2UL ),
+ AF_UNIRANGE_REC( 0x05C4UL, 0x05C5UL ),
+ AF_UNIRANGE_REC( 0x05C7UL, 0x05C7UL ),
+ AF_UNIRANGE_REC( 0xFB1EUL, 0xFB1EUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ const AF_Script_UniRangeRec af_khmr_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x1780UL, 0x17FFUL ), /* Khmer */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_khmr_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x17B7UL, 0x17BDUL ),
+ AF_UNIRANGE_REC( 0x17C6UL, 0x17C6UL ),
+ AF_UNIRANGE_REC( 0x17C9UL, 0x17D3UL ),
+ AF_UNIRANGE_REC( 0x17DDUL, 0x17DDUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ const AF_Script_UniRangeRec af_khms_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x19E0UL, 0x19FFUL ), /* Khmer Symbols */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_khms_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ const AF_Script_UniRangeRec af_lao_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0E80UL, 0x0EFFUL ), /* Lao */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_lao_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0EB1UL, 0x0EB1UL ),
+ AF_UNIRANGE_REC( 0x0EB4UL, 0x0EBCUL ),
+ AF_UNIRANGE_REC( 0x0EC8UL, 0x0ECDUL ),
+ 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( 0x00A0UL, 0x00A9UL ), /* Latin-1 Supplement (no control chars) */
+ AF_UNIRANGE_REC( 0x00ABUL, 0x00B1UL ), /* ... continued */
+ AF_UNIRANGE_REC( 0x00B4UL, 0x00B8UL ), /* ... continued */
+ AF_UNIRANGE_REC( 0x00BBUL, 0x00FFUL ), /* ... continued */
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( 0x02B9UL, 0x02DFUL ), /* Spacing Modifier Letters */
+ AF_UNIRANGE_REC( 0x02E5UL, 0x02FFUL ), /* ... continued */
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( 0x1AB0UL, 0x1ABEUL ), /* Combining Diacritical Marks Extended */
+ AF_UNIRANGE_REC( 0x1D00UL, 0x1D2BUL ), /* Phonetic Extensions */
+ AF_UNIRANGE_REC( 0x1D6BUL, 0x1D77UL ), /* ... continued */
+ AF_UNIRANGE_REC( 0x1D79UL, 0x1D7FUL ), /* ... continued */
+ AF_UNIRANGE_REC( 0x1D80UL, 0x1D9AUL ), /* 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, 0x20B8UL ), /* Currency Symbols ... */
AF_UNIRANGE_REC( 0x20BAUL, 0x20CFUL ), /* ... except new Rupee sign */
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( 0x2C60UL, 0x2C7BUL ), /* Latin Extended-C */
+ AF_UNIRANGE_REC( 0x2C7EUL, 0x2C7FUL ), /* ... continued */
AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */
- AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */
+ AF_UNIRANGE_REC( 0xA720UL, 0xA76FUL ), /* Latin Extended-D */
+ AF_UNIRANGE_REC( 0xA771UL, 0xA7F7UL ), /* ... continued */
+ AF_UNIRANGE_REC( 0xA7FAUL, 0xA7FFUL ), /* ... continued */
+ AF_UNIRANGE_REC( 0xAB30UL, 0xAB5BUL ), /* Latin Extended-E */
+ AF_UNIRANGE_REC( 0xAB60UL, 0xAB6FUL ), /* ... continued */
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_latn_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x005EUL, 0x0060UL ),
+ AF_UNIRANGE_REC( 0x007EUL, 0x007EUL ),
+ AF_UNIRANGE_REC( 0x00A8UL, 0x00A9UL ),
+ AF_UNIRANGE_REC( 0x00AEUL, 0x00B0UL ),
+ AF_UNIRANGE_REC( 0x00B4UL, 0x00B4UL ),
+ AF_UNIRANGE_REC( 0x00B8UL, 0x00B8UL ),
+ AF_UNIRANGE_REC( 0x00BCUL, 0x00BEUL ),
+ AF_UNIRANGE_REC( 0x02B9UL, 0x02DFUL ),
+ AF_UNIRANGE_REC( 0x02E5UL, 0x02FFUL ),
+ AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ),
+ AF_UNIRANGE_REC( 0x1AB0UL, 0x1ABEUL ),
+ AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ),
+ AF_UNIRANGE_REC( 0x2017UL, 0x2017UL ),
+ AF_UNIRANGE_REC( 0x203EUL, 0x203EUL ),
+ AF_UNIRANGE_REC( 0xA788UL, 0xA788UL ),
+ AF_UNIRANGE_REC( 0xA7F8UL, 0xA7FAUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ const AF_Script_UniRangeRec af_latb_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x1D62UL, 0x1D6AUL ), /* some small subscript letters */
+ AF_UNIRANGE_REC( 0x2080UL, 0x209CUL ), /* subscript digits and letters */
+ AF_UNIRANGE_REC( 0x2C7CUL, 0x2C7CUL ), /* latin subscript small letter j */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_latb_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ const AF_Script_UniRangeRec af_latp_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x00AAUL, 0x00AAUL ), /* feminine ordinal indicator */
+ AF_UNIRANGE_REC( 0x00B2UL, 0x00B3UL ), /* superscript two and three */
+ AF_UNIRANGE_REC( 0x00B9UL, 0x00BAUL ), /* superscript one, masc. ord. indic. */
+ AF_UNIRANGE_REC( 0x02B0UL, 0x02B8UL ), /* some latin superscript mod. letters */
+ AF_UNIRANGE_REC( 0x02E0UL, 0x02E4UL ), /* some IPA modifier letters */
+ AF_UNIRANGE_REC( 0x1D2CUL, 0x1D61UL ), /* latin superscript modifier letters */
+ AF_UNIRANGE_REC( 0x1D78UL, 0x1D78UL ), /* modifier letter cyrillic en */
+ AF_UNIRANGE_REC( 0x1D9BUL, 0x1DBFUL ), /* more modifier letters */
+ AF_UNIRANGE_REC( 0x2070UL, 0x207FUL ), /* superscript digits and letters */
+ AF_UNIRANGE_REC( 0x2C7DUL, 0x2C7DUL ), /* modifier letter capital v */
+ AF_UNIRANGE_REC( 0xA770UL, 0xA770UL ), /* modifier letter us */
+ AF_UNIRANGE_REC( 0xA7F8UL, 0xA7F9UL ), /* more modifier letters */
+ AF_UNIRANGE_REC( 0xAB5CUL, 0xAB5FUL ), /* more modifier letters */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_latp_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
+ const AF_Script_UniRangeRec af_mymr_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x1000UL, 0x109FUL ), /* Myanmar */
+ AF_UNIRANGE_REC( 0xA9E0UL, 0xA9FFUL ), /* Myanmar Extended-B */
+ AF_UNIRANGE_REC( 0xAA60UL, 0xAA7FUL ), /* Myanmar Extended-A */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_mymr_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x102DUL, 0x1030UL ),
+ AF_UNIRANGE_REC( 0x1032UL, 0x1037UL ),
+ AF_UNIRANGE_REC( 0x103AUL, 0x103AUL ),
+ AF_UNIRANGE_REC( 0x103DUL, 0x103EUL ),
+ AF_UNIRANGE_REC( 0x1058UL, 0x1059UL ),
+ AF_UNIRANGE_REC( 0x105EUL, 0x1060UL ),
+ AF_UNIRANGE_REC( 0x1071UL, 0x1074UL ),
+ AF_UNIRANGE_REC( 0x1082UL, 0x1082UL ),
+ AF_UNIRANGE_REC( 0x1085UL, 0x1086UL ),
+ AF_UNIRANGE_REC( 0x108DUL, 0x108DUL ),
+ AF_UNIRANGE_REC( 0xA9E5UL, 0xA9E5UL ),
+ AF_UNIRANGE_REC( 0xAA7CUL, 0xAA7CUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_none_uniranges[] =
{
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_none_nonbase_uniranges[] =
+ {
+ 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_telu_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0C00UL, 0x0C00UL ),
+ AF_UNIRANGE_REC( 0x0C3EUL, 0x0C40UL ),
+ AF_UNIRANGE_REC( 0x0C46UL, 0x0C56UL ),
+ AF_UNIRANGE_REC( 0x0C62UL, 0x0C63UL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_thai_uniranges[] =
{
AF_UNIRANGE_REC( 0x0E00UL, 0x0E7FUL ), /* Thai */
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_thai_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0E31UL, 0x0E31UL ),
+ AF_UNIRANGE_REC( 0x0E34UL, 0x0E3AUL ),
+ AF_UNIRANGE_REC( 0x0E47UL, 0x0E4EUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
#ifdef AF_CONFIG_OPTION_INDIC
const AF_Script_UniRangeRec af_beng_uniranges[] =
@@ -123,72 +395,197 @@
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_beng_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0981UL, 0x0981UL ),
+ AF_UNIRANGE_REC( 0x09BCUL, 0x09BCUL ),
+ AF_UNIRANGE_REC( 0x09C1UL, 0x09C4UL ),
+ AF_UNIRANGE_REC( 0x09CDUL, 0x09CDUL ),
+ AF_UNIRANGE_REC( 0x09E2UL, 0x09E3UL ),
+ 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_gujr_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0A81UL, 0x0A82UL ),
+ AF_UNIRANGE_REC( 0x0ABCUL, 0x0ABCUL ),
+ AF_UNIRANGE_REC( 0x0AC1UL, 0x0AC8UL ),
+ AF_UNIRANGE_REC( 0x0ACDUL, 0x0ACDUL ),
+ AF_UNIRANGE_REC( 0x0AE2UL, 0x0AE3UL ),
+ 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_guru_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0A01UL, 0x0A02UL ),
+ AF_UNIRANGE_REC( 0x0A3CUL, 0x0A3EUL ),
+ AF_UNIRANGE_REC( 0x0A41UL, 0x0A51UL ),
+ AF_UNIRANGE_REC( 0x0A70UL, 0x0A71UL ),
+ AF_UNIRANGE_REC( 0x0A75UL, 0x0A75UL ),
+ 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_knda_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0C81UL, 0x0C81UL ),
+ AF_UNIRANGE_REC( 0x0CBCUL, 0x0CBCUL ),
+ AF_UNIRANGE_REC( 0x0CBFUL, 0x0CBFUL ),
+ AF_UNIRANGE_REC( 0x0CC6UL, 0x0CC6UL ),
+ AF_UNIRANGE_REC( 0x0CCCUL, 0x0CCDUL ),
+ AF_UNIRANGE_REC( 0x0CE2UL, 0x0CE3UL ),
+ 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_limb_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x1920UL, 0x1922UL ),
+ AF_UNIRANGE_REC( 0x1927UL, 0x1934UL ),
+ AF_UNIRANGE_REC( 0x1937UL, 0x193BUL ),
+ 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_mlym_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0D01UL, 0x0D01UL ),
+ AF_UNIRANGE_REC( 0x0D4DUL, 0x0D4EUL ),
+ AF_UNIRANGE_REC( 0x0D62UL, 0x0D63UL ),
+ 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_orya_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0B01UL, 0x0B02UL ),
+ AF_UNIRANGE_REC( 0x0B3CUL, 0x0B3CUL ),
+ AF_UNIRANGE_REC( 0x0B3FUL, 0x0B3FUL ),
+ AF_UNIRANGE_REC( 0x0B41UL, 0x0B44UL ),
+ AF_UNIRANGE_REC( 0x0B4DUL, 0x0B56UL ),
+ AF_UNIRANGE_REC( 0x0B62UL, 0x0B63UL ),
+ 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_sinh_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0DCAUL, 0x0DCAUL ),
+ AF_UNIRANGE_REC( 0x0DD2UL, 0x0DD6UL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_sund_uniranges[] =
{
- AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */
+ AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */
+ AF_UNIRANGE_REC( 0x1CC0UL, 0x1CCFUL ), /* Sundanese Supplement */
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+ const AF_Script_UniRangeRec af_sund_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x1B80UL, 0x1B82UL ),
+ AF_UNIRANGE_REC( 0x1BA1UL, 0x1BADUL ),
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_sylo_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0xA802UL, 0xA802UL ),
+ AF_UNIRANGE_REC( 0xA806UL, 0xA806UL ),
+ AF_UNIRANGE_REC( 0xA80BUL, 0xA80BUL ),
+ AF_UNIRANGE_REC( 0xA825UL, 0xA826UL ),
+ 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_taml_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0B82UL, 0x0B82UL ),
+ AF_UNIRANGE_REC( 0x0BC0UL, 0x0BC2UL ),
+ AF_UNIRANGE_REC( 0x0BCDUL, 0x0BCDUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
+
const AF_Script_UniRangeRec af_tibt_uniranges[] =
{
AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_tibt_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x0F18UL, 0x0F19UL ),
+ AF_UNIRANGE_REC( 0x0F35UL, 0x0F35UL ),
+ AF_UNIRANGE_REC( 0x0F37UL, 0x0F37UL ),
+ AF_UNIRANGE_REC( 0x0F39UL, 0x0F39UL ),
+ AF_UNIRANGE_REC( 0x0F3EUL, 0x0F3FUL ),
+ AF_UNIRANGE_REC( 0x0F71UL, 0x0F7EUL ),
+ AF_UNIRANGE_REC( 0x0F80UL, 0x0F84UL ),
+ AF_UNIRANGE_REC( 0x0F86UL, 0x0F87UL ),
+ AF_UNIRANGE_REC( 0x0F8DUL, 0x0FBCUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
#endif /* !AF_CONFIG_OPTION_INDIC */
#ifdef AF_CONFIG_OPTION_CJK
@@ -210,7 +607,6 @@
AF_UNIRANGE_REC( 0x31A0UL, 0x31BFUL ), /* Bopomofo Extended */
AF_UNIRANGE_REC( 0x31C0UL, 0x31EFUL ), /* CJK Strokes */
AF_UNIRANGE_REC( 0x31F0UL, 0x31FFUL ), /* Katakana Phonetic Extensions */
- AF_UNIRANGE_REC( 0x3200UL, 0x32FFUL ), /* Enclosed CJK Letters and Months */
AF_UNIRANGE_REC( 0x3300UL, 0x33FFUL ), /* CJK Compatibility */
AF_UNIRANGE_REC( 0x3400UL, 0x4DBFUL ), /* CJK Unified Ideographs Extension A */
AF_UNIRANGE_REC( 0x4DC0UL, 0x4DFFUL ), /* Yijing Hexagram Symbols */
@@ -224,7 +620,6 @@
AF_UNIRANGE_REC( 0xFF00UL, 0xFFEFUL ), /* Halfwidth and Fullwidth Forms */
AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ), /* Kana Supplement */
AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ), /* Tai Xuan Hing Symbols */
- AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ), /* Enclosed Ideographic Supplement */
AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ), /* CJK Unified Ideographs Extension B */
AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ), /* CJK Unified Ideographs Extension C */
AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ), /* CJK Unified Ideographs Extension D */
@@ -232,6 +627,13 @@
AF_UNIRANGE_REC( 0UL, 0UL )
};
+ const AF_Script_UniRangeRec af_hani_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x302AUL, 0x302FUL ),
+ AF_UNIRANGE_REC( 0x3190UL, 0x319FUL ),
+ AF_UNIRANGE_REC( 0UL, 0UL )
+ };
+
#endif /* !AF_CONFIG_OPTION_CJK */
/* END */
diff --git a/src/autofit/afranges.h b/src/autofit/afranges.h
index 7c78ab0..bca5084 100644
--- a/src/autofit/afranges.h
+++ b/src/autofit/afranges.h
@@ -26,11 +26,17 @@
FT_BEGIN_HEADER
#undef SCRIPT
-#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \
+#define SCRIPT( s, S, d, h, ss ) \
extern const AF_Script_UniRangeRec af_ ## s ## _uniranges[];
#include "afscript.h"
+#undef SCRIPT
+#define SCRIPT( s, S, d, h, ss ) \
+ extern const AF_Script_UniRangeRec af_ ## s ## _nonbase_uniranges[];
+
+#include "afscript.h"
+
/* */
FT_END_HEADER
diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h
index dfcc830..39ec652 100644
--- a/src/autofit/afscript.h
+++ b/src/autofit/afscript.h
@@ -25,114 +25,150 @@
/* by a description string. Then comes the corresponding HarfBuzz */
/* script name tag, followed by a string of standard characters (to */
/* derive the standard width and height of stems). */
+ /* */
+ /* Note that fallback scripts only have a default style, thus we */
+ /* use `HB_SCRIPT_INVALID' as the HarfBuzz script name tag for */
+ /* them. */
SCRIPT( arab, ARAB,
"Arabic",
HB_SCRIPT_ARABIC,
- 0x644, 0x62D, 0x640 ) /* ل ح ـ */
+ "\xD9\x84 \xD8\xAD \xD9\x80" ) /* ل ح ـ */
SCRIPT( cyrl, CYRL,
"Cyrillic",
HB_SCRIPT_CYRILLIC,
- 0x43E, 0x41E, 0x0 ) /* оО */
+ "\xD0\xBE \xD0\x9E" ) /* о О */
SCRIPT( deva, DEVA,
"Devanagari",
HB_SCRIPT_DEVANAGARI,
- 0x920, 0x935, 0x91F ) /* ठ व ट */
+ "\xE0\xA4\xA0 \xE0\xA4\xB5 \xE0\xA4\x9F" ) /* ठ व ट */
SCRIPT( grek, GREK,
"Greek",
HB_SCRIPT_GREEK,
- 0x3BF, 0x39F, 0x0 ) /* οΟ */
+ "\xCE\xBF \xCE\x9F" ) /* ο Ο */
SCRIPT( hebr, HEBR,
"Hebrew",
HB_SCRIPT_HEBREW,
- 0x5DD, 0x0, 0x0 ) /* ם */
+ "\xD7\x9D" ) /* ם */
+
+ /* only digit zero has a simple shape in the Khmer script */
+ SCRIPT( khmr, KHMR,
+ "Khmer",
+ HB_SCRIPT_KHMER,
+ "\xE1\x9F\xA0" ) /* ០ */
+
+ SCRIPT( khms, KHMS,
+ "Khmer Symbols",
+ HB_SCRIPT_INVALID,
+ "\xE1\xA7\xA1 \xE1\xA7\xAA" ) /* ᧡ ᧪ */
+
+ /* only digit zero has a simple shape in the Lao script */
+ SCRIPT( lao, LAO,
+ "Lao",
+ HB_SCRIPT_LAO,
+ "\xE0\xBB\x90" ) /* ໐ */
SCRIPT( latn, LATN,
"Latin",
HB_SCRIPT_LATIN,
- 'o', 'O', '0' )
+ "o O 0" )
+
+ SCRIPT( latb, LATB,
+ "Latin Subscript Fallback",
+ HB_SCRIPT_INVALID,
+ "\xE2\x82\x92 \xE2\x82\x80" ) /* ₒ ₀ */
+
+ SCRIPT( latp, LATP,
+ "Latin Superscript Fallback",
+ HB_SCRIPT_INVALID,
+ "\xE1\xB5\x92 \xE1\xB4\xBC \xE2\x81\xB0" ) /* ᵒ ᴼ ⁰ */
+
+ SCRIPT( mymr, MYMR,
+ "Myanmar",
+ HB_SCRIPT_MYANMAR,
+ "\xE1\x80\x9D \xE1\x80\x84 \xE1\x80\x82" ) /* ဝ င ဂ */
SCRIPT( none, NONE,
"no script",
HB_SCRIPT_INVALID,
- 0x0, 0x0, 0x0 )
+ "" )
/* there are no simple forms for letters; we thus use two digit shapes */
SCRIPT( telu, TELU,
"Telugu",
HB_SCRIPT_TELUGU,
- 0xC66, 0xC67, 0x0 ) /* ౦ ౧ */
+ "\xE0\xB1\xA6 \xE0\xB1\xA7" ) /* ౦ ౧ */
SCRIPT( thai, THAI,
"Thai",
HB_SCRIPT_THAI,
- 0xE32, 0xE45, 0xE50 ) /* า ๅ ๐ */
+ "\xE0\xB8\xB2 \xE0\xB9\x85 \xE0\xB9\x90" ) /* า ๅ ๐ */
#ifdef AF_CONFIG_OPTION_INDIC
SCRIPT( beng, BENG,
"Bengali",
HB_SCRIPT_BENGALI,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( gujr, GUJR,
"Gujarati",
HB_SCRIPT_GUJARATI,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( guru, GURU,
"Gurmukhi",
HB_SCRIPT_GURMUKHI,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( knda, KNDA,
"Kannada",
HB_SCRIPT_KANNADA,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( limb, LIMB,
"Limbu",
HB_SCRIPT_LIMBU,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( mlym, MLYM,
"Malayalam",
HB_SCRIPT_MALAYALAM,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( orya, ORYA,
"Oriya",
HB_SCRIPT_ORIYA,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( sinh, SINH,
"Sinhala",
HB_SCRIPT_SINHALA,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( sund, SUND,
"Sundanese",
HB_SCRIPT_SUNDANESE,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( sylo, SYLO,
"Syloti Nagri",
HB_SCRIPT_SYLOTI_NAGRI,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( taml, TAML,
"Tamil",
HB_SCRIPT_TAMIL,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
SCRIPT( tibt, TIBT,
"Tibetan",
HB_SCRIPT_TIBETAN,
- 'o', 0x0, 0x0 ) /* XXX */
+ "o" ) /* XXX */
#endif /* AF_CONFIG_OPTION_INDIC */
@@ -141,7 +177,7 @@
SCRIPT( hani, HANI,
"CJKV ideographs",
HB_SCRIPT_HAN,
- 0x7530, 0x56D7, 0x0 ) /* 田囗 */
+ "\xE7\x94\xB0 \xE5\x9B\x97" ) /* 田 囗 */
#endif /* AF_CONFIG_OPTION_CJK */
diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c
new file mode 100644
index 0000000..6ba9190
--- /dev/null
+++ b/src/autofit/afshaper.c
@@ -0,0 +1,676 @@
+/***************************************************************************/
+/* */
+/* afshaper.c */
+/* */
+/* HarfBuzz interface for accessing OpenType features (body). */
+/* */
+/* Copyright 2013-2015 by */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include "afglobal.h"
+#include "aftypes.h"
+#include "afshaper.h"
+
+#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
+
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_afshaper
+
+
+ /*
+ * We use `sets' (in the HarfBuzz sense, which comes quite near to the
+ * usual mathematical meaning) to manage both lookups and glyph indices.
+ *
+ * 1. For each coverage, collect lookup IDs in a set. Note that an
+ * auto-hinter `coverage' is represented by one `feature', and a
+ * feature consists of an arbitrary number of (font specific) `lookup's
+ * that actually do the mapping job. Please check the OpenType
+ * specification for more details on features and lookups.
+ *
+ * 2. Create glyph ID sets from the corresponding lookup sets.
+ *
+ * 3. The glyph set corresponding to AF_COVERAGE_DEFAULT is computed
+ * with all lookups specific to the OpenType script activated. It
+ * relies on the order of AF_DEFINE_STYLE_CLASS entries so that
+ * special coverages (like `oldstyle figures') don't get overwritten.
+ *
+ */
+
+
+ /* load coverage tags */
+#undef COVERAGE
+#define COVERAGE( name, NAME, description, \
+ tag1, tag2, tag3, tag4 ) \
+ static const hb_tag_t name ## _coverage[] = \
+ { \
+ HB_TAG( tag1, tag2, tag3, tag4 ), \
+ HB_TAG_NONE \
+ };
+
+
+#include "afcover.h"
+
+
+ /* define mapping between coverage tags and AF_Coverage */
+#undef COVERAGE
+#define COVERAGE( name, NAME, description, \
+ tag1, tag2, tag3, tag4 ) \
+ name ## _coverage,
+
+
+ static const hb_tag_t* coverages[] =
+ {
+#include "afcover.h"
+
+ NULL /* AF_COVERAGE_DEFAULT */
+ };
+
+
+ /* load HarfBuzz script tags */
+#undef SCRIPT
+#define SCRIPT( s, S, d, h, ss ) h,
+
+
+ static const hb_script_t scripts[] =
+ {
+#include "afscript.h"
+ };
+
+
+ FT_Error
+ af_shaper_get_coverage( AF_FaceGlobals globals,
+ AF_StyleClass style_class,
+ FT_UShort* gstyles )
+ {
+ hb_face_t* face;
+
+ hb_set_t* gsub_lookups; /* GSUB lookups for a given script */
+ hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */
+ hb_set_t* gpos_lookups; /* GPOS lookups for a given script */
+ hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */
+
+ hb_script_t script;
+ const hb_tag_t* coverage_tags;
+ hb_tag_t script_tags[] = { HB_TAG_NONE,
+ HB_TAG_NONE,
+ HB_TAG_NONE,
+ HB_TAG_NONE };
+
+ hb_codepoint_t idx;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ int count;
+#endif
+
+
+ if ( !globals || !style_class || !gstyles )
+ return FT_THROW( Invalid_Argument );
+
+ face = hb_font_get_face( globals->hb_font );
+
+ gsub_lookups = hb_set_create();
+ gsub_glyphs = hb_set_create();
+ gpos_lookups = hb_set_create();
+ gpos_glyphs = hb_set_create();
+
+ coverage_tags = coverages[style_class->coverage];
+ script = scripts[style_class->script];
+
+ /* Convert a HarfBuzz script tag into the corresponding OpenType */
+ /* tag or tags -- some Indic scripts like Devanagari have an old */
+ /* and a new set of features. */
+ hb_ot_tags_from_script( script,
+ &script_tags[0],
+ &script_tags[1] );
+
+ /* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */
+ /* as the second tag. We change that to HB_TAG_NONE except for the */
+ /* default script. */
+ if ( style_class->script == globals->module->default_script &&
+ style_class->coverage == AF_COVERAGE_DEFAULT )
+ {
+ if ( script_tags[0] == HB_TAG_NONE )
+ script_tags[0] = HB_OT_TAG_DEFAULT_SCRIPT;
+ else
+ {
+ if ( script_tags[1] == HB_TAG_NONE )
+ script_tags[1] = HB_OT_TAG_DEFAULT_SCRIPT;
+ else if ( script_tags[1] != HB_OT_TAG_DEFAULT_SCRIPT )
+ script_tags[2] = HB_OT_TAG_DEFAULT_SCRIPT;
+ }
+ }
+ else
+ {
+ if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT )
+ script_tags[1] = HB_TAG_NONE;
+ }
+
+ hb_ot_layout_collect_lookups( face,
+ HB_OT_TAG_GSUB,
+ script_tags,
+ NULL,
+ coverage_tags,
+ gsub_lookups );
+
+ if ( hb_set_is_empty( gsub_lookups ) )
+ goto Exit; /* nothing to do */
+
+ hb_ot_layout_collect_lookups( face,
+ HB_OT_TAG_GPOS,
+ script_tags,
+ NULL,
+ coverage_tags,
+ gpos_lookups );
+
+ FT_TRACE4(( "GSUB lookups (style `%s'):\n"
+ " ",
+ af_style_names[style_class->style] ));
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ count = 0;
+#endif
+
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE4(( " %d", idx ));
+ count++;
+#endif
+
+ /* get output coverage of GSUB feature */
+ hb_ot_layout_lookup_collect_glyphs( face,
+ HB_OT_TAG_GSUB,
+ idx,
+ NULL,
+ NULL,
+ NULL,
+ gsub_glyphs );
+ }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !count )
+ FT_TRACE4(( " (none)" ));
+ FT_TRACE4(( "\n\n" ));
+#endif
+
+ FT_TRACE4(( "GPOS lookups (style `%s'):\n"
+ " ",
+ af_style_names[style_class->style] ));
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ count = 0;
+#endif
+
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE4(( " %d", idx ));
+ count++;
+#endif
+
+ /* get input coverage of GPOS feature */
+ hb_ot_layout_lookup_collect_glyphs( face,
+ HB_OT_TAG_GPOS,
+ idx,
+ NULL,
+ gpos_glyphs,
+ NULL,
+ NULL );
+ }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !count )
+ FT_TRACE4(( " (none)" ));
+ FT_TRACE4(( "\n\n" ));
+#endif
+
+ /*
+ * We now check whether we can construct blue zones, using glyphs
+ * covered by the feature only. In case there is not a single zone
+ * (this is, not a single character is covered), we skip this coverage.
+ *
+ */
+ if ( style_class->coverage != AF_COVERAGE_DEFAULT )
+ {
+ AF_Blue_Stringset bss = style_class->blue_stringset;
+ const AF_Blue_StringRec* bs = &af_blue_stringsets[bss];
+
+ FT_Bool found = 0;
+
+
+ for ( ; bs->string != AF_BLUE_STRING_MAX; bs++ )
+ {
+ const char* p = &af_blue_strings[bs->string];
+
+
+ while ( *p )
+ {
+ hb_codepoint_t ch;
+
+
+ GET_UTF8_CHAR( ch, p );
+
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups,
+ &idx ); )
+ {
+ hb_codepoint_t gidx = FT_Get_Char_Index( globals->face, ch );
+
+
+ if ( hb_ot_layout_lookup_would_substitute( face, idx,
+ &gidx, 1, 1 ) )
+ {
+ found = 1;
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !found )
+ {
+ FT_TRACE4(( " no blue characters found; style skipped\n" ));
+ goto Exit;
+ }
+ }
+
+ /*
+ * Various OpenType features might use the same glyphs at different
+ * vertical positions; for example, superscript and subscript glyphs
+ * could be the same. However, the auto-hinter is completely
+ * agnostic of OpenType features after the feature analysis has been
+ * completed: The engine then simply receives a glyph index and returns a
+ * hinted and usually rendered glyph.
+ *
+ * Consider the superscript feature of font `pala.ttf': Some of the
+ * glyphs are `real', this is, they have a zero vertical offset, but
+ * most of them are small caps glyphs shifted up to the superscript
+ * position (this is, the `sups' feature is present in both the GSUB and
+ * GPOS tables). The code for blue zones computation actually uses a
+ * feature's y offset so that the `real' glyphs get correct hints. But
+ * later on it is impossible to decide whether a glyph index belongs to,
+ * say, the small caps or superscript feature.
+ *
+ * For this reason, we don't assign a style to a glyph if the current
+ * feature covers the glyph in both the GSUB and the GPOS tables. This
+ * is quite a broad condition, assuming that
+ *
+ * (a) glyphs that get used in multiple features are present in a
+ * feature without vertical shift,
+ *
+ * and
+ *
+ * (b) a feature's GPOS data really moves the glyph vertically.
+ *
+ * Not fulfilling condition (a) makes a font larger; it would also
+ * reduce the number of glyphs that could be addressed directly without
+ * using OpenType features, so this assumption is rather strong.
+ *
+ * Condition (b) is much weaker, and there might be glyphs which get
+ * missed. However, the OpenType features we are going to handle are
+ * primarily located in GSUB, and HarfBuzz doesn't provide an API to
+ * directly get the necessary information from the GPOS table. A
+ * possible solution might be to directly parse the GPOS table to find
+ * out whether a glyph gets shifted vertically, but this is something I
+ * would like to avoid if not really necessary.
+ *
+ * Note that we don't follow this logic for the default coverage.
+ * Complex scripts like Devanagari have mandatory GPOS features to
+ * position many glyph elements, using mark-to-base or mark-to-ligature
+ * tables; the number of glyphs missed due to condition (b) would be far
+ * too large.
+ *
+ */
+ if ( style_class->coverage != AF_COVERAGE_DEFAULT )
+ hb_set_subtract( gsub_glyphs, gpos_glyphs );
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE4(( " glyphs without GPOS data (`*' means already assigned)" ));
+ count = 0;
+#endif
+
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &idx ); )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !( count % 10 ) )
+ FT_TRACE4(( "\n"
+ " " ));
+
+ FT_TRACE4(( " %d", idx ));
+ count++;
+#endif
+
+ /* glyph indices returned by `hb_ot_layout_lookup_collect_glyphs' */
+ /* can be arbitrary: some fonts use fake indices for processing */
+ /* internal to GSUB or GPOS, which is fully valid */
+ if ( idx >= (hb_codepoint_t)globals->glyph_count )
+ continue;
+
+ if ( gstyles[idx] == AF_STYLE_UNASSIGNED )
+ gstyles[idx] = (FT_UShort)style_class->style;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ else
+ FT_TRACE4(( "*" ));
+#endif
+ }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !count )
+ FT_TRACE4(( "\n"
+ " (none)" ));
+ FT_TRACE4(( "\n\n" ));
+#endif
+
+ Exit:
+ hb_set_destroy( gsub_lookups );
+ hb_set_destroy( gsub_glyphs );
+ hb_set_destroy( gpos_lookups );
+ hb_set_destroy( gpos_glyphs );
+
+ return FT_Err_Ok;
+ }
+
+
+ /* construct HarfBuzz features */
+#undef COVERAGE
+#define COVERAGE( name, NAME, description, \
+ tag1, tag2, tag3, tag4 ) \
+ static const hb_feature_t name ## _feature[] = \
+ { \
+ { \
+ HB_TAG( tag1, tag2, tag3, tag4 ), \
+ 1, 0, (unsigned int)-1 \
+ } \
+ };
+
+
+#include "afcover.h"
+
+
+ /* define mapping between HarfBuzz features and AF_Coverage */
+#undef COVERAGE
+#define COVERAGE( name, NAME, description, \
+ tag1, tag2, tag3, tag4 ) \
+ name ## _feature,
+
+
+ static const hb_feature_t* features[] =
+ {
+#include "afcover.h"
+
+ NULL /* AF_COVERAGE_DEFAULT */
+ };
+
+
+ void*
+ af_shaper_buf_create( FT_Face face )
+ {
+ FT_UNUSED( face );
+
+ return (void*)hb_buffer_create();
+ }
+
+
+ void
+ af_shaper_buf_destroy( FT_Face face,
+ void* buf )
+ {
+ FT_UNUSED( face );
+
+ hb_buffer_destroy( (hb_buffer_t*)buf );
+ }
+
+
+ const char*
+ af_shaper_get_cluster( const char* p,
+ AF_StyleMetrics metrics,
+ void* buf_,
+ unsigned int* count )
+ {
+ AF_StyleClass style_class;
+ const hb_feature_t* feature;
+ FT_Int upem;
+ const char* q;
+ int len;
+
+ hb_buffer_t* buf = (hb_buffer_t*)buf_;
+ hb_font_t* font;
+ hb_codepoint_t dummy;
+
+
+ upem = (FT_Int)metrics->globals->face->units_per_EM;
+ style_class = metrics->style_class;
+ feature = features[style_class->coverage];
+
+ font = metrics->globals->hb_font;
+
+ /* we shape at a size of units per EM; this means font units */
+ hb_font_set_scale( font, upem, upem );
+
+ while ( *p == ' ' )
+ p++;
+
+ /* count bytes up to next space (or end of buffer) */
+ q = p;
+ while ( !( *q == ' ' || *q == '\0' ) )
+ GET_UTF8_CHAR( dummy, q );
+ len = (int)( q - p );
+
+ /* feed character(s) to the HarfBuzz buffer */
+ hb_buffer_clear_contents( buf );
+ hb_buffer_add_utf8( buf, p, len, 0, len );
+
+ /* we let HarfBuzz guess the script and writing direction */
+ hb_buffer_guess_segment_properties( buf );
+
+ /* shape buffer, which means conversion from character codes to */
+ /* glyph indices, possibly applying a feature */
+ hb_shape( font, buf, feature, feature ? 1 : 0 );
+
+ if ( feature )
+ {
+ hb_buffer_t* hb_buf = metrics->globals->hb_buf;
+
+ unsigned int gcount;
+ hb_glyph_info_t* ginfo;
+
+ unsigned int hb_gcount;
+ hb_glyph_info_t* hb_ginfo;
+
+
+ /* we have to check whether applying a feature does actually change */
+ /* glyph indices; otherwise the affected glyph or glyphs aren't */
+ /* available at all in the feature */
+
+ hb_buffer_clear_contents( hb_buf );
+ hb_buffer_add_utf8( hb_buf, p, len, 0, len );
+ hb_buffer_guess_segment_properties( hb_buf );
+ hb_shape( font, hb_buf, NULL, 0 );
+
+ ginfo = hb_buffer_get_glyph_infos( buf, &gcount );
+ hb_ginfo = hb_buffer_get_glyph_infos( hb_buf, &hb_gcount );
+
+ if ( gcount == hb_gcount )
+ {
+ unsigned int i;
+
+
+ for (i = 0; i < gcount; i++ )
+ if ( ginfo[i].codepoint != hb_ginfo[i].codepoint )
+ break;
+
+ if ( i == gcount )
+ {
+ /* both buffers have identical glyph indices */
+ hb_buffer_clear_contents( buf );
+ }
+ }
+ }
+
+ *count = hb_buffer_get_length( buf );
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( feature && *count > 1 )
+ FT_TRACE1(( "af_shaper_get_cluster:"
+ " input character mapped to multiple glyphs\n" ));
+#endif
+
+ return q;
+ }
+
+
+ FT_ULong
+ af_shaper_get_elem( AF_StyleMetrics metrics,
+ void* buf_,
+ unsigned int idx,
+ FT_Long* advance,
+ FT_Long* y_offset )
+ {
+ hb_buffer_t* buf = (hb_buffer_t*)buf_;
+ hb_glyph_info_t* ginfo;
+ hb_glyph_position_t* gpos;
+ unsigned int gcount;
+
+ FT_UNUSED( metrics );
+
+
+ ginfo = hb_buffer_get_glyph_infos( buf, &gcount );
+ gpos = hb_buffer_get_glyph_positions( buf, &gcount );
+
+ if ( idx >= gcount )
+ return 0;
+
+ if ( advance )
+ *advance = gpos[idx].x_advance;
+ if ( y_offset )
+ *y_offset = gpos[idx].y_offset;
+
+ return ginfo[idx].codepoint;
+ }
+
+
+#else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
+
+
+ FT_Error
+ af_shaper_get_coverage( AF_FaceGlobals globals,
+ AF_StyleClass style_class,
+ FT_UShort* gstyles )
+ {
+ FT_UNUSED( globals );
+ FT_UNUSED( style_class );
+ FT_UNUSED( gstyles );
+
+ return FT_Err_Ok;
+ }
+
+
+ void*
+ af_shaper_buf_create( FT_Face face )
+ {
+ FT_Error error;
+ FT_Memory memory = face->memory;
+ FT_ULong* buf;
+
+
+ FT_MEM_ALLOC( buf, sizeof ( FT_ULong ) );
+
+ return (void*)buf;
+ }
+
+
+ void
+ af_shaper_buf_destroy( FT_Face face,
+ void* buf )
+ {
+ FT_Memory memory = face->memory;
+
+
+ FT_FREE( buf );
+ }
+
+
+ const char*
+ af_shaper_get_cluster( const char* p,
+ AF_StyleMetrics metrics,
+ void* buf_,
+ unsigned int* count )
+ {
+ FT_Face face = metrics->globals->face;
+ FT_ULong ch, dummy = 0;
+ FT_ULong* buf = (FT_ULong*)buf_;
+
+
+ while ( *p == ' ' )
+ p++;
+
+ GET_UTF8_CHAR( ch, p );
+
+ /* since we don't have an engine to handle clusters, */
+ /* we scan the characters but return zero */
+ while ( !( *p == ' ' || *p == '\0' ) )
+ GET_UTF8_CHAR( dummy, p );
+
+ if ( dummy )
+ {
+ *buf = 0;
+ *count = 0;
+ }
+ else
+ {
+ *buf = FT_Get_Char_Index( face, ch );
+ *count = 1;
+ }
+
+ return p;
+ }
+
+
+ FT_ULong
+ af_shaper_get_elem( AF_StyleMetrics metrics,
+ void* buf_,
+ unsigned int idx,
+ FT_Long* advance,
+ FT_Long* y_offset )
+ {
+ FT_Face face = metrics->globals->face;
+ FT_ULong glyph_index = *(FT_ULong*)buf_;
+
+ FT_UNUSED( idx );
+
+
+ if ( advance )
+ FT_Get_Advance( face,
+ glyph_index,
+ FT_LOAD_NO_SCALE |
+ FT_LOAD_NO_HINTING |
+ FT_LOAD_IGNORE_TRANSFORM,
+ advance );
+
+ if ( y_offset )
+ *y_offset = 0;
+
+ return glyph_index;
+ }
+
+
+#endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */
+
+
+/* END */
diff --git a/src/autofit/afshaper.h b/src/autofit/afshaper.h
new file mode 100644
index 0000000..db1b4e0
--- /dev/null
+++ b/src/autofit/afshaper.h
@@ -0,0 +1,71 @@
+/***************************************************************************/
+/* */
+/* afshaper.h */
+/* */
+/* HarfBuzz interface for accessing OpenType features (specification). */
+/* */
+/* Copyright 2013-2015 by */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+#ifndef __AFSHAPER_H__
+#define __AFSHAPER_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
+
+#include <hb.h>
+#include <hb-ot.h>
+#include <hb-ft.h>
+
+#endif
+
+
+FT_BEGIN_HEADER
+
+ FT_Error
+ af_shaper_get_coverage( AF_FaceGlobals globals,
+ AF_StyleClass style_class,
+ FT_UShort* gstyles );
+
+
+ void*
+ af_shaper_buf_create( FT_Face face );
+
+ void
+ af_shaper_buf_destroy( FT_Face face,
+ void* buf );
+
+ const char*
+ af_shaper_get_cluster( const char* p,
+ AF_StyleMetrics metrics,
+ void* buf_,
+ unsigned int* count );
+
+ FT_ULong
+ af_shaper_get_elem( AF_StyleMetrics metrics,
+ void* buf_,
+ unsigned int idx,
+ FT_Long* x_advance,
+ FT_Long* y_offset );
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __AFSHAPER_H__ */
+
+
+/* END */
diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h
index bfd5bb9..e214442 100644
--- a/src/autofit/afstyles.h
+++ b/src/autofit/afstyles.h
@@ -27,7 +27,9 @@
/* coverage. */
/* */
/* Note that styles using `AF_COVERAGE_DEFAULT' should always */
- /* come after styles with other coverages. */
+ /* come after styles with other coverages. Also note that */
+ /* fallback scripts only use `AF_COVERAGE_DEFAULT' for its */
+ /* style. */
/* */
/* Example: */
/* */
@@ -90,6 +92,13 @@
META_STYLE_LATIN( cyrl, CYRL, "Cyrillic" )
+ STYLE( deva_dflt, DEVA_DFLT,
+ "Devanagari default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_DEVA,
+ AF_BLUE_STRINGSET_DEVA,
+ AF_COVERAGE_DEFAULT )
+
META_STYLE_LATIN( grek, GREK, "Greek" )
STYLE( hebr_dflt, HEBR_DFLT,
@@ -98,13 +107,42 @@
AF_SCRIPT_HEBR,
AF_BLUE_STRINGSET_HEBR,
AF_COVERAGE_DEFAULT )
+
+ STYLE( khmr_dflt, KHMR_DFLT,
+ "Khmer default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_KHMR,
+ AF_BLUE_STRINGSET_KHMR,
+ AF_COVERAGE_DEFAULT )
+
+ STYLE( khms_dflt, KHMS_DFLT,
+ "Khmer Symbols default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_KHMS,
+ AF_BLUE_STRINGSET_KHMS,
+ AF_COVERAGE_DEFAULT )
+
+ STYLE( lao_dflt, LAO_DFLT,
+ "Lao default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_LAO,
+ AF_BLUE_STRINGSET_LAO,
+ AF_COVERAGE_DEFAULT )
+
META_STYLE_LATIN( latn, LATN, "Latin" )
- STYLE( deva_dflt, DEVA_DFLT,
- "Devanagari default style",
+ STYLE( latb_dflt, LATB_DFLT,
+ "Latin subscript fallback default style",
AF_WRITING_SYSTEM_LATIN,
- AF_SCRIPT_DEVA,
- AF_BLUE_STRINGSET_DEVA,
+ AF_SCRIPT_LATB,
+ AF_BLUE_STRINGSET_LATB,
+ AF_COVERAGE_DEFAULT )
+
+ STYLE( latp_dflt, LATP_DFLT,
+ "Latin superscript fallback default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_LATP,
+ AF_BLUE_STRINGSET_LATP,
AF_COVERAGE_DEFAULT )
#ifdef FT_OPTION_AUTOFIT2
@@ -116,6 +154,13 @@
AF_COVERAGE_DEFAULT )
#endif
+ STYLE( mymr_dflt, MYMR_DFLT,
+ "Myanmar default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_MYMR,
+ AF_BLUE_STRINGSET_MYMR,
+ AF_COVERAGE_DEFAULT )
+
STYLE( none_dflt, NONE_DFLT,
"no style",
AF_WRITING_SYSTEM_DUMMY,
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 78e3fd7..b483619 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -41,6 +41,10 @@
#include "afblue.h"
+#ifdef FT_DEBUG_AUTOFIT
+#include FT_CONFIG_STANDARD_LIBRARY_H
+#endif
+
FT_BEGIN_HEADER
@@ -54,8 +58,6 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_AUTOFIT
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
extern int _af_debug_disable_horz_hints;
extern int _af_debug_disable_vert_hints;
extern int _af_debug_disable_blue_hints;
@@ -209,13 +211,19 @@ 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,
AF_StyleMetrics metrics );
typedef void
- (*AF_WritingSystem_ApplyHintsFunc)( AF_GlyphHints hints,
+ (*AF_WritingSystem_ApplyHintsFunc)( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_StyleMetrics metrics );
@@ -273,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;
@@ -291,15 +300,16 @@ extern void* _af_debug_hints;
/*************************************************************************/
/*
- * Each script is associated with a set of Unicode ranges that gets used
- * to test whether the font face supports the script.
+ * Each script is associated with two sets of Unicode ranges to test
+ * whether the font face supports the script, and which non-base
+ * characters the script contains.
*
* We use four-letter script tags from the OpenType specification,
* extended by `NONE', which indicates `no script'.
*/
#undef SCRIPT
-#define SCRIPT( s, S, d, h, sc1, sc2, sc3 ) \
+#define SCRIPT( s, S, d, h, ss ) \
AF_SCRIPT_ ## S,
/* The list of known scripts. */
@@ -329,11 +339,11 @@ extern void* _af_debug_hints;
{
AF_Script script;
- AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */
+ /* last element in the ranges must be { 0, 0 } */
+ AF_Script_UniRange script_uni_ranges;
+ AF_Script_UniRange script_uni_nonbase_ranges;
- FT_UInt32 standard_char1; /* for default width and height */
- FT_UInt32 standard_char2; /* ditto */
- FT_UInt32 standard_char3; /* ditto */
+ const char* standard_charstring; /* for default width and height */
} AF_ScriptClassRec;
@@ -483,6 +493,7 @@ extern void* _af_debug_hints;
m_init, \
m_scale, \
m_done, \
+ m_stdw, \
h_init, \
h_apply ) \
FT_CALLBACK_TABLE_DEF \
@@ -495,6 +506,7 @@ extern void* _af_debug_hints;
m_init, \
m_scale, \
m_done, \
+ m_stdw, \
\
h_init, \
h_apply \
@@ -509,17 +521,15 @@ extern void* _af_debug_hints;
script_class, \
script, \
ranges, \
- std_char1, \
- std_char2, \
- std_char3 ) \
+ nonbase_ranges, \
+ std_charstring ) \
FT_CALLBACK_TABLE_DEF \
const AF_ScriptClassRec script_class = \
{ \
script, \
ranges, \
- std_char1, \
- std_char2, \
- std_char3 \
+ nonbase_ranges, \
+ std_charstring, \
};
@@ -562,16 +572,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; \
}
@@ -583,17 +594,15 @@ extern void* _af_debug_hints;
script_class, \
script_, \
ranges, \
- std_char1, \
- std_char2, \
- std_char3 ) \
+ nonbase_ranges, \
+ std_charstring ) \
FT_LOCAL_DEF( void ) \
FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \
{ \
- ac->script = script_; \
- ac->script_uni_ranges = ranges; \
- ac->standard_char1 = std_char1; \
- ac->standard_char2 = std_char2; \
- ac->standard_char3 = std_char3; \
+ ac->script = script_; \
+ ac->script_uni_ranges = ranges; \
+ ac->script_uni_nonbase_ranges = nonbase_ranges; \
+ ac->standard_charstring = std_charstring; \
}
diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c
index 59af4f0..ae92db1 100644
--- a/src/autofit/afwarp.c
+++ b/src/autofit/afwarp.c
@@ -193,7 +193,7 @@
warper->best_scale = org_scale;
warper->best_delta = org_delta;
- warper->best_score = INT_MIN;
+ warper->best_score = FT_INT_MIN;
warper->best_distort = 0;
axis = &hints->axis[dim];
diff --git a/src/autofit/afwarp.h b/src/autofit/afwarp.h
index 5a6208a..6069b6b 100644
--- a/src/autofit/afwarp.h
+++ b/src/autofit/afwarp.h
@@ -25,7 +25,7 @@ FT_BEGIN_HEADER
#define AF_WARPER_SCALE
-#define AF_WARPER_FLOOR( x ) ( (x) & ~TYPEOF( x )63 )
+#define AF_WARPER_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
#define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 )
diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c
index b6ed4a0..a971a24 100644
--- a/src/autofit/autofit.c
+++ b/src/autofit/autofit.c
@@ -34,7 +34,7 @@
#include "afcjk.c"
#include "afindic.c"
-#include "hbshim.c"
+#include "afshaper.c"
#include "afloader.c"
#include "afmodule.c"