From 82e8b6bf2542fc2aaf52d37c62c293c9bab15e77 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 27 Mar 2013 03:07:49 +0000 Subject: XeTeX 0.9999.2 git-svn-id: svn://tug.org/texlive/trunk@29523 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/ChangeLog | 4 + Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp | 9 +- .../texk/web2c/xetexdir/XeTeXLayoutInterface.cpp | 154 ++++++++++++--------- .../texk/web2c/xetexdir/XeTeXLayoutInterface.h | 17 +-- Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 4 +- Build/source/texk/web2c/xetexdir/xetex.web | 2 +- Build/source/texk/web2c/xetexdir/xetex_version.h | 2 +- 7 files changed, 109 insertions(+), 83 deletions(-) diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index 260bece38ae..f774702e089 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,7 @@ +2013-03-27 Khaled Hosny + + XeTeX 0.9999.2 + 2013-03-25 Peter Breitenlohner * am/xetex.am (EXTRA_DIST): Add NEWS and image/README. diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp index 53f595d6555..84dea428393 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp @@ -504,7 +504,8 @@ XeTeXFontMgr::getDesignSize(XeTeXFont font) void XeTeXFontMgr::getOpSizeRecAndStyleFlags(Font* theFont) { - XeTeXFont font = createFont(theFont->fontRef, 655360); + XeTeXFont font = createFont(theFont->fontRef, 655360); + XeTeXFontInst* fontInst = (XeTeXFontInst*) font; if (font != 0) { const OpSizeRec* pSizeRec = getOpSize(font); if (pSizeRec != NULL) { @@ -521,7 +522,7 @@ XeTeXFontMgr::getOpSizeRecAndStyleFlags(Font* theFont) } done_size: - const TT_OS2* os2Table = (TT_OS2*)getFontTable(font, ft_sfnt_os2); + const TT_OS2* os2Table = (TT_OS2*) fontInst->getFontTable(ft_sfnt_os2); if (os2Table != NULL) { theFont->weight = os2Table->usWeightClass; theFont->width = os2Table->usWidthClass; @@ -531,7 +532,7 @@ XeTeXFontMgr::getOpSizeRecAndStyleFlags(Font* theFont) theFont->isItalic = (sel & (1 << 0)) != 0; } - const TT_Header* headTable = (TT_Header*)getFontTable(font, ft_sfnt_head); + const TT_Header* headTable = (TT_Header*) fontInst->getFontTable(ft_sfnt_head); if (headTable != NULL) { uint16_t ms = headTable->Mac_Style; if ((ms & (1 << 0)) != 0) @@ -540,7 +541,7 @@ XeTeXFontMgr::getOpSizeRecAndStyleFlags(Font* theFont) theFont->isItalic = true; } - const TT_Postscript* postTable = (const TT_Postscript*)getFontTable(font, ft_sfnt_post); + const TT_Postscript* postTable = (const TT_Postscript*) fontInst->getFontTable(ft_sfnt_post); if (postTable != NULL) { theFont->slant = (int)(1000 * (tan(Fix2D(-postTable->italicAngle) * M_PI / 180.0))); } diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp index 7744eead793..0788ee19d3e 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp @@ -192,12 +192,6 @@ getFontTablePtr(XeTeXFont font, uint32_t tableTag) return const_cast(((XeTeXFontInst*)font)->getFontTable(tableTag)); } -void* -getFontTable(XeTeXFont font, FT_Sfnt_Tag tableTag) -{ - return const_cast(((XeTeXFontInst*)font)->getFontTable(tableTag)); -} - Fixed getSlant(XeTeXFont font) { @@ -205,145 +199,171 @@ getSlant(XeTeXFont font) return D2Fix(tan(-italAngle * M_PI / 180.0)); } -static uint32_t -getLargerScriptListTable(XeTeXFont font, hb_tag_t** scriptList, hb_tag_t* tableTag) +static unsigned int +getLargerScriptListTable(XeTeXFont font, hb_tag_t** scriptList) { + unsigned int rval = 0; + hb_face_t* face = hb_font_get_face(((XeTeXFontInst*)font)->getHbFont()); hb_tag_t* scriptListSub = NULL; hb_tag_t* scriptListPos = NULL; - uint32_t scriptCountSub = hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, NULL, NULL); + unsigned int scriptCountSub = hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, NULL, NULL); scriptListSub = (hb_tag_t*) xmalloc(scriptCountSub * sizeof(hb_tag_t*)); hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, &scriptCountSub, scriptListSub); - uint32_t scriptCountPos = hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GPOS, 0, NULL, NULL); + unsigned int scriptCountPos = hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GPOS, 0, NULL, NULL); scriptListPos = (hb_tag_t*) xmalloc(scriptCountPos * sizeof(hb_tag_t*)); hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, &scriptCountPos, scriptListPos); if (scriptCountSub > scriptCountPos) { if (scriptList != NULL) *scriptList = scriptListSub; - if (tableTag != NULL) - *tableTag = HB_OT_TAG_GSUB; - return scriptCountSub; + rval = scriptCountSub; } else { if (scriptList != NULL) *scriptList = scriptListPos; - if (tableTag != NULL) - *tableTag = HB_OT_TAG_GPOS; - return scriptCountPos; + rval = scriptCountPos; } + + return rval; } -uint32_t +unsigned int countScripts(XeTeXFont font) { - return getLargerScriptListTable(font, NULL, NULL); + return getLargerScriptListTable(font, NULL); } -uint32_t -getIndScript(XeTeXFont font, uint32_t index) +hb_tag_t +getIndScript(XeTeXFont font, unsigned int index) { - hb_tag_t* scriptList; + hb_tag_t rval = 0; - uint32_t scriptCount = getLargerScriptListTable(font, &scriptList, NULL); - if (scriptList == NULL) - return 0; + hb_tag_t* scriptList; - if (index < scriptCount) - return scriptList[index]; + unsigned int scriptCount = getLargerScriptListTable(font, &scriptList); + if (scriptList != NULL) { + if (index < scriptCount) + rval = scriptList[index]; + } - return 0; + return rval; } -uint32_t -countScriptLanguages(XeTeXFont font, uint32_t script) +unsigned int +countLanguages(XeTeXFont font, hb_tag_t script) { + unsigned int rval = 0; + hb_face_t* face = hb_font_get_face(((XeTeXFontInst*)font)->getHbFont()); hb_tag_t* scriptList; - hb_tag_t tableTag; - uint32_t scriptCount = getLargerScriptListTable(font, &scriptList, &tableTag); - if (scriptList == NULL) - return 0; - - for (int i = 0; i < scriptCount; i++) { - if (scriptList[i] == script) { - return hb_ot_layout_script_get_language_tags (face, tableTag, i, 0, NULL, NULL); + unsigned int scriptCount = getLargerScriptListTable(font, &scriptList); + if (scriptList != NULL) { + for (int i = 0; i < scriptCount; i++) { + if (scriptList[i] == script) { + rval += hb_ot_layout_script_get_language_tags (face, HB_OT_TAG_GSUB, i, 0, NULL, NULL); + rval += hb_ot_layout_script_get_language_tags (face, HB_OT_TAG_GPOS, i, 0, NULL, NULL); + break; + } } } - return 0; + + return rval; } -uint32_t -getIndScriptLanguage(XeTeXFont font, uint32_t script, uint32_t index) +hb_tag_t +getIndLanguage(XeTeXFont font, hb_tag_t script, unsigned int index) { + hb_tag_t rval = 0; + hb_face_t* face = hb_font_get_face(((XeTeXFontInst*)font)->getHbFont()); hb_tag_t* scriptList; - hb_tag_t tableTag; - uint32_t scriptCount = getLargerScriptListTable(font, &scriptList, &tableTag); - if (scriptList == NULL) - return 0; + unsigned int scriptCount = getLargerScriptListTable(font, &scriptList); + if (scriptList != NULL) { + for (int i = 0; i < scriptCount; i++) { + if (scriptList[i] == script) { + unsigned int langCount; + hb_tag_t* langList; - for (int i = 0; i < scriptCount; i++) { - if (scriptList[i] == script) { - uint32_t langCount = hb_ot_layout_script_get_language_tags(face, tableTag, i, 0, NULL, NULL); - hb_tag_t* langList = (hb_tag_t*) xmalloc(langCount * sizeof(hb_tag_t*)); - hb_ot_layout_script_get_language_tags(face, tableTag, i, 0, &langCount, langList); + langCount = hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GSUB, i, 0, NULL, NULL); + langList = (hb_tag_t*) xcalloc(langCount, sizeof(hb_tag_t*)); + hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GSUB, i, 0, &langCount, langList); + + if (index < langCount) { + rval = langList[index]; + break; + } - if (index < langCount) - return langList[index]; + free(langList); - return 0; + langCount = hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GPOS, i, 0, NULL, NULL); + langList = (hb_tag_t*) xcalloc(langCount, sizeof(hb_tag_t*)); + hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GPOS, i, 0, &langCount, langList); + + if (index < langCount) { + rval = langList[index]; + break; + } + + free(langList); + } } } - return 0; + + return rval; } -uint32_t -countFeatures(XeTeXFont font, uint32_t script, uint32_t language) +unsigned int +countFeatures(XeTeXFont font, hb_tag_t script, hb_tag_t language) { + unsigned int rval = 0; + hb_face_t* face = hb_font_get_face(((XeTeXFontInst*)font)->getHbFont()); - uint32_t total = 0; for (int i = 0; i < 2; ++i) { - uint32_t scriptIndex, langIndex = 0; + unsigned int scriptIndex, langIndex = 0; hb_tag_t tableTag = i == 0 ? HB_OT_TAG_GSUB : HB_OT_TAG_GPOS; if (hb_ot_layout_table_find_script(face, tableTag, script, &scriptIndex)) { if (hb_ot_layout_script_find_language(face, tableTag, scriptIndex, language, &langIndex) || language == 0) { - total += hb_ot_layout_language_get_feature_tags(face, tableTag, scriptIndex, langIndex, 0, NULL, NULL); + rval += hb_ot_layout_language_get_feature_tags(face, tableTag, scriptIndex, langIndex, 0, NULL, NULL); } } } - return total; + return rval; } -uint32_t -getIndFeature(XeTeXFont font, uint32_t script, uint32_t language, uint32_t index) +hb_tag_t +getIndFeature(XeTeXFont font, hb_tag_t script, hb_tag_t language, unsigned int index) { + hb_tag_t rval = 0; + hb_face_t* face = hb_font_get_face(((XeTeXFontInst*)font)->getHbFont()); for (int i = 0; i < 2; ++i) { - uint32_t scriptIndex, langIndex = 0; + unsigned int scriptIndex, langIndex = 0; hb_tag_t tableTag = i == 0 ? HB_OT_TAG_GSUB : HB_OT_TAG_GPOS; if (hb_ot_layout_table_find_script(face, tableTag, script, &scriptIndex)) { if (hb_ot_layout_script_find_language(face, tableTag, scriptIndex, language, &langIndex) || language == 0) { - uint32_t featCount = hb_ot_layout_language_get_feature_tags(face, tableTag, scriptIndex, langIndex, 0, NULL, NULL); + unsigned int featCount = hb_ot_layout_language_get_feature_tags(face, tableTag, scriptIndex, langIndex, 0, NULL, NULL); hb_tag_t* featList = (hb_tag_t*) xmalloc(featCount * sizeof(hb_tag_t*)); hb_ot_layout_language_get_feature_tags(face, tableTag, scriptIndex, langIndex, 0, &featCount, featList); - if (index < featCount) - return featList[index]; + if (index < featCount) { + rval = featList[index]; + break; + } index -= featCount; } } } - return 0; + return rval; } uint32_t @@ -565,7 +585,7 @@ getGlyphWidth(XeTeXFont font, uint32_t gid) return ((XeTeXFontInst*)font)->getGlyphWidth(gid); } -uint32_t +unsigned int countGlyphs(XeTeXFont font) { return ((XeTeXFontInst*)font)->getNumGlyphs(); diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h index 05240e69efc..4b2b8e2dde3 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h +++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.h @@ -88,18 +88,19 @@ double getDesignSize(XeTeXFont font); void deleteFont(XeTeXFont font); void* getFontTablePtr(XeTeXFont font, uint32_t tableTag); -void* getFontTable(XeTeXFont font, FT_Sfnt_Tag tableTag); Fixed getSlant(XeTeXFont font); -uint32_t countScripts(XeTeXFont font); -uint32_t getIndScript(XeTeXFont font, uint32_t index); -uint32_t countScriptLanguages(XeTeXFont font, uint32_t script); -uint32_t getIndScriptLanguage(XeTeXFont font, uint32_t script, uint32_t index); -uint32_t countFeatures(XeTeXFont font, uint32_t script, uint32_t language); -uint32_t getIndFeature(XeTeXFont font, uint32_t script, uint32_t language, uint32_t index); +unsigned int countScripts(XeTeXFont font); +unsigned int countLanguages(XeTeXFont font, hb_tag_t script); +unsigned int countFeatures(XeTeXFont font, hb_tag_t script, hb_tag_t language); +unsigned int countGlyphs(XeTeXFont font); + +hb_tag_t getIndScript(XeTeXFont font, unsigned int index); +hb_tag_t getIndLanguage(XeTeXFont font, hb_tag_t script, unsigned int index); +hb_tag_t getIndFeature(XeTeXFont font, hb_tag_t script, hb_tag_t language, unsigned int index); + float getGlyphWidth(XeTeXFont font, uint32_t gid); -uint32_t countGlyphs(XeTeXFont font); XeTeXLayoutEngine createLayoutEngine(PlatformFontRef fontRef, XeTeXFont font, hb_tag_t script, hb_tag_t language, hb_feature_t* features, int nFeatures, char **shapers, uint32_t rgbValue, diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index e5e9ca3bfb8..4a53cdac119 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -1362,7 +1362,7 @@ otfontget1(integer what, void* pEngine, integer param) XeTeXFont fontInst = getFont(engine); switch (what) { case XeTeX_OT_count_languages: - return countScriptLanguages(fontInst, param); + return countLanguages(fontInst, param); break; case XeTeX_OT_script_code: @@ -1391,7 +1391,7 @@ otfontget2(integer what, void* pEngine, integer param1, integer param2) XeTeXFont fontInst = getFont(engine); switch (what) { case XeTeX_OT_language_code: - return getIndScriptLanguage(fontInst, param1, param2); + return getIndLanguage(fontInst, param1, param2); break; case XeTeX_OT_count_features: diff --git a/Build/source/texk/web2c/xetexdir/xetex.web b/Build/source/texk/web2c/xetexdir/xetex.web index fef28971141..6afd00105e9 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.web +++ b/Build/source/texk/web2c/xetexdir/xetex.web @@ -319,7 +319,7 @@ known as `\eTeX'. @# @d XeTeX_version=0 { \.{\\XeTeXversion} } @d XeTeX_revision==".9999" { \.{\\XeTeXrevision} } -@d XeTeX_version_string=='-0.9999.1' {current \XeTeX\ version} +@d XeTeX_version_string=='-0.9999.2' {current \XeTeX\ version} @# @d XeTeX_banner=='This is XeTeX, Version 3.1415926',eTeX_version_string,XeTeX_version_string {printed when \XeTeX\ starts} diff --git a/Build/source/texk/web2c/xetexdir/xetex_version.h b/Build/source/texk/web2c/xetexdir/xetex_version.h index ba8ab21dd6f..2907ffcfae5 100644 --- a/Build/source/texk/web2c/xetexdir/xetex_version.h +++ b/Build/source/texk/web2c/xetexdir/xetex_version.h @@ -1 +1 @@ -#define XETEX_VERSION "0.9999.1" +#define XETEX_VERSION "0.9999.2" -- cgit v1.2.3