Aric Stewart : usp10: Add beginning support for GSUB Alternate Substitution Subtable.
Alexandre Julliard
julliard at winehq.org
Tue Aug 3 13:10:37 CDT 2010
Module: wine
Branch: master
Commit: d4befda3c7c3a7664e7093db534f282356034ca4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d4befda3c7c3a7664e7093db534f282356034ca4
Author: Aric Stewart <aric at codeweavers.com>
Date: Tue Aug 3 11:16:49 2010 -0500
usp10: Add beginning support for GSUB Alternate Substitution Subtable.
---
dlls/usp10/shape.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 0018ae5..210022d 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -219,6 +219,18 @@ typedef struct{
GSUB_SubstLookupRecord SubstLookupRecord[1];
}GSUB_ChainContextSubstFormat3_4;
+typedef struct {
+ WORD SubstFormat; /* = 1 */
+ WORD Coverage;
+ WORD AlternateSetCount;
+ WORD AlternateSet[1];
+} GSUB_AlternateSubstFormat1;
+
+typedef struct{
+ WORD GlyphCount;
+ WORD Alternate[1];
+} GSUB_AlternateSet;
+
static INT GSUB_apply_lookup(const GSUB_LookupList* lookup, INT lookup_index, WORD *glyphs, INT glyph_index, INT write_dir, INT *glyph_count);
/* the orders of joined_forms and contextual_features need to line up */
@@ -400,6 +412,38 @@ static INT GSUB_apply_SingleSubst(const GSUB_LookupTable *look, WORD *glyphs, IN
return GSUB_E_NOGLYPH;
}
+static INT GSUB_apply_AlternateSubst(const GSUB_LookupTable *look, WORD *glyphs, INT glyph_index, INT write_dir, INT *glyph_count)
+{
+ int j;
+ TRACE("Alternate Substitution Subtable\n");
+
+ for (j = 0; j < GET_BE_WORD(look->SubTableCount); j++)
+ {
+ int offset;
+ const GSUB_AlternateSubstFormat1 *asf1;
+ INT index;
+
+ offset = GET_BE_WORD(look->SubTable[j]);
+ asf1 = (const GSUB_AlternateSubstFormat1*)((const BYTE*)look+offset);
+ offset = GET_BE_WORD(asf1->Coverage);
+
+ index = GSUB_is_glyph_covered((const BYTE*)asf1+offset, glyphs[glyph_index]);
+ if (index != -1)
+ {
+ const GSUB_AlternateSet *as;
+ offset = GET_BE_WORD(asf1->AlternateSet[index]);
+ as = (const GSUB_AlternateSet*)((const BYTE*)asf1+offset);
+ FIXME("%i alternates, picking index 0\n",GET_BE_WORD(as->GlyphCount));
+
+ TRACE(" Glyph 0x%x ->",glyphs[glyph_index]);
+ glyphs[glyph_index] = GET_BE_WORD(as->Alternate[0]);
+ TRACE(" 0x%x\n",glyphs[glyph_index]);
+ return glyph_index + 1;
+ }
+ }
+ return GSUB_E_NOGLYPH;
+}
+
static INT GSUB_apply_LigatureSubst(const GSUB_LookupTable *look, WORD *glyphs, INT glyph_index, INT write_dir, INT *glyph_count)
{
int j;
@@ -572,6 +616,8 @@ static INT GSUB_apply_lookup(const GSUB_LookupList* lookup, INT lookup_index, WO
{
case 1:
return GSUB_apply_SingleSubst(look, glyphs, glyph_index, write_dir, glyph_count);
+ case 3:
+ return GSUB_apply_AlternateSubst(look, glyphs, glyph_index, write_dir, glyph_count);
case 4:
return GSUB_apply_LigatureSubst(look, glyphs, glyph_index, write_dir, glyph_count);
case 6:
More information about the wine-cvs
mailing list