diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2006-12-30 18:08:59 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2006-12-30 18:08:59 +0000 |
commit | d61b7994261c65c073d0b25c4781e9de589a21ed (patch) | |
tree | 2440b0667536add6b5d8574886d325c54fd4397a | |
parent | e6aa481b744668ffaa1165fc8205f45454c44edf (diff) |
improved search for regular face in opentype families
git-svn-id: svn://tug.org/texlive/trunk@3027 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp index ebcf270eb47..63b7f13f389 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp @@ -124,14 +124,18 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize) if (f != nameToFamily.end()) { // look for a family member with the "regular" bit set in OS/2 + int regFonts = 0; for (i = f->second->styles->begin(); i != f->second->styles->end(); ++i) if (i->second->isReg) { - font = i->second; - break; + if (regFonts == 0) + font = i->second; + ++regFonts; } - - if (font == NULL) { - // try for style "Regular", "Plain", or "Normal" + + // families with Ornament or similar fonts may flag those as Regular, + // which confuses the search above... so try some known names + if (font == NULL || regFonts > 1) { + // try for style "Regular", "Plain", "Normal", "Roman" i = f->second->styles->find("Regular"); if (i != f->second->styles->end()) font = i->second; @@ -143,6 +147,11 @@ XeTeXFontMgr::findFont(const char* name, char* variant, double ptSize) i = f->second->styles->find("Normal"); if (i != f->second->styles->end()) font = i->second; + else { + i = f->second->styles->find("Roman"); + if (i != f->second->styles->end()) + font = i->second; + } } } } |