Draw: Font::IsSerif, IsScript

git-svn-id: svn://ultimatepp.org/upp/trunk@12206 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-08-31 05:52:29 +00:00
parent 6b3a725cbf
commit d7423f981e
5 changed files with 23 additions and 3 deletions

View file

@ -170,8 +170,22 @@ Vector<FaceInfo> GetAllFacesSys()
fi.info = Font::TTF;
CFRef<CFStringRef> fs = CFStringCreateWithCString(NULL, ~s, kCFStringEncodingUTF8);
CFRef<CTFontRef> ctfont = CTFontCreateWithName(fs, 12, NULL);
if(CTFontGetSymbolicTraits(ctfont) & kCTFontMonoSpaceTrait)
dword traits = CTFontGetSymbolicTraits(ctfont);
if(traits & kCTFontMonoSpaceTrait)
fi.info |= Font::FIXEDPITCH;
switch(traits & kCTFontClassMaskTrait) {
case kCTFontOldStyleSerifsClass:
case kCTFontTransitionalSerifsClass:
case kCTFontModernSerifsClass:
case kCTFontClarendonSerifsClass:
case kCTFontSlabSerifsClass:
case kCTFontFreeformSerifsClass:
fi.info |= Font::SERIFSTYLE;
break;
case kCTFontScriptsClass:
fi.info |= Font::SCRIPTSTYLE;
break;
}
}
return r;

View file

@ -132,8 +132,8 @@ file
CocoUtil.mm,
CocoDraw.mm,
CocoDrawOp.mm,
CocoDrawText.mm,
CocoImage.mm,
CocoDrawText.mm,
CocoCtrl.h,
CocoTop.h,
CocoApp.mm,

View file

@ -1,5 +1,6 @@
sooner:
- replacement fonts
- minimize, maximaze
- fix package organiser link options (joining link options missing space)
@ -13,7 +14,6 @@ later:
- apple debugger
- progress for assist opens too much, probably problem with delay?
- package organizer initial size too small
- void WakeUpGuiThread(void)
- fullscreen mode issues
- CommonFontInfo GetFontInfoSys(Font font) metrics
- GetGlyphInfoSys metrics
@ -38,6 +38,7 @@ later:
done:
- void WakeUpGuiThread(void)
- not all additional cursors are correct
- ignoreclick
- Sort fonts

View file

@ -73,6 +73,8 @@ public:
SCALEABLE = 0x0002,
TTF = 0x0004,
SPECIAL = 0x0010,
SERIFSTYLE = 0x0020,
SCRIPTSTYLE = 0x0040,
};
static int GetFaceCount();
@ -173,6 +175,8 @@ public:
bool IsScaleable() const { return Fi().scaleable; }
bool IsSpecial() const { return GetFaceInfo() & SPECIAL; }
bool IsTrueType() const { return Fi().ttf; }
bool IsSerif() const { return GetFaceInfo() & SERIFSTYLE; }
bool IsScript() const { return GetFaceInfo() & SCRIPTSTYLE; }
String GetTextFlags() const;
void ParseTextFlags(const char *s);

View file

@ -308,6 +308,7 @@ bool Replace(Font fnt, int chr, Font& rfnt)
f = cache[q].mdst;
}
rfnt = f;
// LOG(fnt.GetFaceName() << " -> " << rfnt.GetFaceName());
return true;
}
}