diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-05-13 15:23:54 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-05-13 15:23:54 +0000 |
commit | fd35b82f19e360b19b3d9b109df5664477cb2e44 (patch) | |
tree | 4b259ded004d0122ebdb74c98ab8a025566d4b99 /Build | |
parent | 7888c3aa65c1787b0e215fd52ad3146a0524dc79 (diff) |
merged xetex 0.998.3 from scripts.sil.org
git-svn-id: svn://tug.org/texlive/trunk@8110 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp | 55 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp | 35 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.h | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.h | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.mm | 19 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.ch | 40 |
8 files changed, 130 insertions, 31 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp index 8695c83567e..4e88c896451 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp @@ -45,6 +45,25 @@ authorization from SIL International. extern Fixed loadedfontdesignsize; +// functions from the Pascal/WEB side +extern "C" { + void zprintnl(int s); + void zprintchar(int c); + void zprintint(int i); + void zprintscaled(int sc); + void begindiagnostic(); + void zenddiagnostic(int nl); + int gettracingfontsstate(); +}; + +// see cpascal.h +#define printcstring(STR) \ + do { \ + const char* ch_ptr = (STR); \ + while (*ch_ptr) \ + zprintchar(*(ch_ptr++)); \ + } while (0) + XeTeXFontMgr* XeTeXFontMgr::sFontManager = NULL; char XeTeXFontMgr::sReqEngine = 0; @@ -89,10 +108,32 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize) { std::string nameStr(name); Font* font = NULL; + int tracing = gettracingfontsstate(); int dsize = 100; loadedfontdesignsize = 655360L; + if (tracing > 0) { + begindiagnostic(); + zprintnl('F'); + printcstring("ont \""); + printcstring(name); + if (variant != NULL) { + printcstring("/"); + printcstring(variant); + } + printcstring("\""); + if (ptSize < 0) { + printcstring(" scaled "); + zprintint(X2Fix(-ptSize)); + } + else { + printcstring(" at "); + zprintscaled(X2Fix(ptSize)); + printcstring("pt"); + } + } + for (int pass = 0; pass < 2; ++pass) { // try full name as given std::map<std::string,Font*>::iterator i = nameToFont.find(nameStr); @@ -183,8 +224,13 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize) } } - if (font == NULL) + if (font == NULL) { + if (tracing > 0) { + printcstring(" not found"); + zenddiagnostic(0); + } return 0; + } Family* parent = font->parent; @@ -391,6 +437,13 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize) if (font != NULL && font->opSizeInfo.designSize != 0) loadedfontdesignsize = (font->opSizeInfo.designSize << 16L) / 10; + if (tracing > 0) { + zprintnl(' '); + printcstring("-> "); + printcstring(getPlatformFontDesc(font->fontRef).c_str()); + zenddiagnostic(0); + } + return font->fontRef; } diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h index 91df461f33d..ba23b05c28e 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.h @@ -103,6 +103,8 @@ protected: virtual void initialize() = 0; virtual void terminate(); + virtual std::string getPlatformFontDesc(PlatformFontRef font) const = 0; + class Font; class Family; diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp index 5f94c3d5fa4..56e2dd92316 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.cpp @@ -83,10 +83,10 @@ XeTeXFontMgr_FC::readNames(FcPattern* pat) NameCollection* names = new NameCollection; char* pathname; - if (FcPatternGetString(pat, FC_FILE, 0, (FcChar8**)&pathname) == FcTrue) + if (FcPatternGetString(pat, FC_FILE, 0, (FcChar8**)&pathname) != FcResultMatch) return names; int index; - if (FcPatternGetInteger(pat, FC_INDEX, 0, &index) == FcTrue) + if (FcPatternGetInteger(pat, FC_INDEX, 0, &index) != FcResultMatch) return names; FT_Face face; @@ -159,13 +159,13 @@ XeTeXFontMgr_FC::readNames(FcPattern* pat) } else { index = 0; - while (FcPatternGetString(pat, FC_FULLNAME, index++, (FcChar8**)&name) == FcFalse) + while (FcPatternGetString(pat, FC_FULLNAME, index++, (FcChar8**)&name) == FcResultMatch) appendToList(&names->fullNames, name); index = 0; - while (FcPatternGetString(pat, FC_FAMILY, index++, (FcChar8**)&name) == FcFalse) + while (FcPatternGetString(pat, FC_FAMILY, index++, (FcChar8**)&name) == FcResultMatch) appendToList(&names->familyNames, name); index = 0; - while (FcPatternGetString(pat, FC_STYLE, index++, (FcChar8**)&name) == FcFalse) + while (FcPatternGetString(pat, FC_STYLE, index++, (FcChar8**)&name) == FcResultMatch) appendToList(&names->styleNames, name); if (names->fullNames.size() == 0) { @@ -192,11 +192,11 @@ XeTeXFontMgr_FC::getOpSizeRecAndStyleFlags(Font* theFont) // try to get values from FontConfig, as it apparently wasn't an sfnt FcPattern* pat = theFont->fontRef; int value; - if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &value) == FcFalse) + if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &value) == FcResultMatch) theFont->weight = value; - if (FcPatternGetInteger(pat, FC_WIDTH, 0, &value) == FcFalse) + if (FcPatternGetInteger(pat, FC_WIDTH, 0, &value) == FcResultMatch) theFont->width = value; - if (FcPatternGetInteger(pat, FC_SLANT, 0, &value) == FcFalse) + if (FcPatternGetInteger(pat, FC_SLANT, 0, &value) == FcResultMatch) theFont->slant = value; } } @@ -246,7 +246,7 @@ XeTeXFontMgr_FC::searchForHostPlatformFonts(const std::string& name) char* s; int i; - for (i = 0; FcPatternGetString(pat, FC_FULLNAME, i, (FcChar8**)&s) == FcFalse; ++i) { + for (i = 0; FcPatternGetString(pat, FC_FULLNAME, i, (FcChar8**)&s) == FcResultMatch; ++i) { if (name == s) { NameCollection* names = readNames(pat); addToMaps(pat, names); @@ -256,7 +256,7 @@ XeTeXFontMgr_FC::searchForHostPlatformFonts(const std::string& name) } } - for (i = 0; FcPatternGetString(pat, FC_FAMILY, i, (FcChar8**)&s) == FcFalse; ++i) { + for (i = 0; FcPatternGetString(pat, FC_FAMILY, i, (FcChar8**)&s) == FcResultMatch; ++i) { if (name == s || (hyph && famName == s)) { NameCollection* names = readNames(pat); addToMaps(pat, names); @@ -265,7 +265,7 @@ XeTeXFontMgr_FC::searchForHostPlatformFonts(const std::string& name) goto next_font; } char* t; - for (int j = 0; FcPatternGetString(pat, FC_STYLE, j, (FcChar8**)&t) == FcFalse; ++j) { + for (int j = 0; FcPatternGetString(pat, FC_STYLE, j, (FcChar8**)&t) == FcResultMatch; ++j) { std::string full(s); full += " "; full += t; @@ -322,3 +322,16 @@ XeTeXFontMgr_FC::terminate() if (utf8Conv != NULL) ucnv_close(utf8Conv); } + +std::string +XeTeXFontMgr_FC::getPlatformFontDesc(PlatformFontRef font) const +{ + std::string path; + FcChar8* s; + if (FcPatternGetString(font, FC_FILE, 0, (FcChar8**)&s) == FcResultMatch) + path = (char*)s; + else + path = "[unknown]"; + return path; +} + diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.h b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.h index 764b7ec1d0e..9ebc2134a9a 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.h +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_FC.h @@ -51,6 +51,8 @@ protected: virtual void searchForHostPlatformFonts(const std::string& name); virtual NameCollection* readNames(FcPattern* pat); + + std::string getPlatformFontDesc(PlatformFontRef font) const; }; #endif /* __XETEX_FONT_MGR_FC_H */ diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.h b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.h index e889d62102d..b4a6e553512 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.h +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.h @@ -53,6 +53,8 @@ protected: virtual NameCollection* readNames(ATSUFontID fontID); + virtual std::string getPlatformFontDesc(PlatformFontRef font) const; + private: void addFontsToCaches(CFArrayRef fonts); diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.mm b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.mm index c7c7652a10c..ac0a833e1a4 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.mm +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr_Mac.mm @@ -277,4 +277,23 @@ XeTeXFontMgr_Mac::terminate() } } +std::string +XeTeXFontMgr_Mac::getPlatformFontDesc(PlatformFontRef font) const +{ + FSSpec fileSpec; + std::string path; + if (ATSFontGetFileSpecification(font, &fileSpec) == noErr) { + FSRef fileRef; + if (FSpMakeFSRef(&fileSpec, &fileRef) == noErr) { + UInt8 posixPath[PATH_MAX]; + if (FSRefMakePath(&fileRef, posixPath, PATH_MAX) == noErr) { + path = (char*)posixPath; + } + } + } + if (path.length() == 0) + path = "[unknown]"; + return path; +} + #endif // XETEX_MAC diff --git a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp index 4625fa84362..71baa5aab0a 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXOTMath.cpp @@ -128,8 +128,8 @@ const mathConstantIndex TeX_sym_to_OT_map[] = { subscriptShiftDown, // ?? superscriptBaselineDropMax, // ?? subscriptBaselineDropMin, // ?? - stackDisplayStyleGapMin, - stackGapMin, + delimitedSubFormulaMinHeight, + unknown, // using quad instead for now axisHeight }; @@ -138,7 +138,7 @@ getnativemathsyparam(int f, int n) { int rval = 0; - if (n == math_quad) + if (n == math_quad || n == delim2) rval = fontsize[f]; else { if (n < sizeof(TeX_sym_to_OT_map) / sizeof(mathConstantIndex)) { diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch index da084242e35..fd9c6eacf58 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.ch +++ b/Build/source/texk/web2c/xetexdir/xetex.ch @@ -65,7 +65,7 @@ authorization from SIL International. @d XeTeX_version=0 @d XeTeX_revision==".998" -@d XeTeX_version_string=='-0.998.2-dev' {current \XeTeX\ version} +@d XeTeX_version_string=='-0.998.3' {current \XeTeX\ version} @z @x @@ -118,7 +118,8 @@ authorization from SIL International. @# @d XeTeX_default_input_encoding_code = 7 {|str_number| of encoding name if mode = ICU} @# -@d eTeX_states=8 {number of \eTeX\ state variables in |eqtb|} +@d XeTeX_tracing_fonts_code = 8 {non-zero to log native fonts used} +@d eTeX_states=9 {number of \eTeX\ state variables in |eqtb|} @z @x @@ -3579,20 +3580,18 @@ begin if f<=256+font_base then dvi_out(length(font_name[f])); @<Output the font name whose internal number is |f|@>; @y -if font_mapping[f]<>nil then begin - l:=0; - k:=str_start_macro(font_name[f]); - while (l=0) and (k<str_start_macro(font_name[f]+1)) do begin - if so(str_pool[k]) = ":" then l:=k-str_start_macro(font_name[f]); - incr(k); - end; - dvi_out(l); - for k:=str_start_macro(font_name[f]) to str_start_macro(font_name[f])+l-1 do - dvi_out(so(str_pool[k])); -end else begin -dvi_out(length(font_name[f])); -@<Output the font name whose internal number is |f|@>; +l:=0; k:=str_start_macro(font_name[f]); +{search for colon; we will truncate the name there} +while (l=0) and (k<str_start_macro(font_name[f]+1)) do begin + if so(str_pool[k]) = ":" then l:=k-str_start_macro(font_name[f]); + incr(k); end; +if l=0 then l:=length(font_name[f]); {no colon found} +dvi_out(l); +for k:=str_start_macro(font_area[f]) to str_start_macro(font_area[f]+1)-1 do + dvi_out(so(str_pool[k])); +for k:=str_start_macro(font_name[f]) to str_start_macro(font_name[f])+l-1 do + dvi_out(so(str_pool[k])); end; @z @@ -8328,6 +8327,7 @@ font_char_ic_code: begin scan_font_ident; q:=cur_val; scan_usv_num; @d XeTeX_dash_break_en == (XeTeX_dash_break_state>0) @d XeTeX_input_normalization_state == eTeX_state(XeTeX_input_normalization_code) +@d XeTeX_tracing_fonts_state == eTeX_state(XeTeX_tracing_fonts_code) @d XeTeX_default_input_mode == eTeX_state(XeTeX_default_input_mode_code) @d XeTeX_default_input_encoding == eTeX_state(XeTeX_default_input_encoding_code) @@ -8343,6 +8343,7 @@ eTeX_state_code+XeTeX_use_glyph_metrics_code:print_esc("XeTeXuseglyphmetrics"); eTeX_state_code+XeTeX_inter_char_tokens_code:print_esc("XeTeXinterchartokenstate"); eTeX_state_code+XeTeX_dash_break_code:print_esc("XeTeXdashbreakstate"); eTeX_state_code+XeTeX_input_normalization_code:print_esc("XeTeXinputnormalization"); +eTeX_state_code+XeTeX_tracing_fonts_code:print_esc("XeTeXtracingfonts"); @z @x @@ -8365,6 +8366,8 @@ primitive("XeTeXdashbreakstate",assign_int,eTeX_state_base+XeTeX_dash_break_code primitive("XeTeXinputnormalization",assign_int,eTeX_state_base+XeTeX_input_normalization_code); @!@:XeTeX_input_normalization_}{\.{\\XeTeX_input_normalization} primitive@> +primitive("XeTeXtracingfonts",assign_int,eTeX_state_base+XeTeX_tracing_fonts_code); + primitive("XeTeXinputencoding",extension,XeTeX_input_encoding_extension_code); primitive("XeTeXdefaultencoding",extension,XeTeX_default_encoding_extension_code); @z @@ -8895,10 +8898,15 @@ end; function get_input_normalization_state: integer; begin - if eqtb=nil then get_input_normalization_state:=0 + if eqtb=nil then get_input_normalization_state:=0 { may be called before eqtb is initialized } else get_input_normalization_state:=XeTeX_input_normalization_state; end; +function get_tracing_fonts_state: integer; +begin + get_tracing_fonts_state:=XeTeX_tracing_fonts_state; +end; + @z @x |