From d61b7994261c65c073d0b25c4781e9de589a21ed Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sat, 30 Dec 2006 18:08:59 +0000 Subject: improved search for regular face in opentype families git-svn-id: svn://tug.org/texlive/trunk@3027 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp') 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; + } } } } -- cgit v1.2.3