Module: wine Branch: master Commit: 5ad2f6e152680ed82e32f6fb8e53a15b185a9a90 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5ad2f6e152680ed82e32f6fb8e...
Author: Aric Stewart aric@codeweavers.com Date: Thu May 27 15:03:21 2010 -0500
usp10: Break out a function to apply a GSUB feature to an entire string of glyphs.
---
dlls/usp10/shape.c | 68 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c index d7e9811..fe2ea53 100644 --- a/dlls/usp10/shape.c +++ b/dlls/usp10/shape.c @@ -549,6 +549,57 @@ static VOID *load_gsub_table(HDC hdc) return GSUB_Table; }
+static int apply_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, void* GSUB_Table, WORD *pwOutGlyphs, int write_dir, INT* pcGlyphs, const char* feat) +{ + int i; + + if (GSUB_Table) + { + const GSUB_Header *header; + const GSUB_Script *script; + const GSUB_LangSys *language; + const GSUB_Feature *feature; + + if (!GSUB_Table) + return GSUB_E_NOFEATURE; + + header = GSUB_Table; + + script = GSUB_get_script_table(header, get_opentype_script(hdc,psa)); + if (!script) + { + TRACE("Script not found\n"); + return GSUB_E_NOFEATURE; + } + language = GSUB_get_lang_table(script, "xxxx"); + if (!language) + { + TRACE("Language not found\n"); + return GSUB_E_NOFEATURE; + } + feature = GSUB_get_feature(header, language, feat); + if (!feature) + { + TRACE("%s feature not found\n",feat); + return GSUB_E_NOFEATURE; + } + + i = 0; + TRACE("applying feature %s\n",feat); + while(i < *pcGlyphs) + { + INT nextIndex; + nextIndex = GSUB_apply_feature(header, feature, pwOutGlyphs, i, write_dir, pcGlyphs); + if (nextIndex > GSUB_E_NOGLYPH) + i = nextIndex; + else + i++; + } + return *pcGlyphs; + } + return GSUB_E_NOFEATURE; +} + static CHAR neighbour_joining_type(int i, int delta, const CHAR* context_type, INT cchLen, SCRIPT_ANALYSIS *psa) { if (i + delta < 0) @@ -668,22 +719,7 @@ void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WC } }
- /* Required ligature substitution */ - if (psc->GSUB_Table) - { - i = 0; - while(i < *pcGlyphs) - { - INT nextIndex; - nextIndex = apply_GSUB_feature_to_glyph(hdc, psa, psc->GSUB_Table, pwOutGlyphs, i, dirL, pcGlyphs, "rlig"); - if (nextIndex > GSUB_E_NOGLYPH) - i = nextIndex; - else if (nextIndex == GSUB_E_NOFEATURE) - break; - else - i++; - } - } + apply_GSUB_feature(hdc, psa, psc->GSUB_Table, pwOutGlyphs, dirL, pcGlyphs, "rlig");
HeapFree(GetProcessHeap(),0,context_shape); HeapFree(GetProcessHeap(),0,context_type);