From 12bb53705e58d1e08e1ee55b19ec274a199309a6 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 31 Aug 2018 12:06:42 +0000 Subject: [PATCH] Draw: Win32 support for Font::IsScript, IsSerif git-svn-id: svn://ultimatepp.org/upp/trunk@12208 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/FontFc.cpp | 2 +- uppsrc/Draw/FontWin32.cpp | 4 ++++ uppsrc/Draw/src.tpp/Font_en-us.tpp | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/uppsrc/Draw/FontFc.cpp b/uppsrc/Draw/FontFc.cpp index 5096cb99a..8db0561ee 100644 --- a/uppsrc/Draw/FontFc.cpp +++ b/uppsrc/Draw/FontFc.cpp @@ -202,7 +202,7 @@ GlyphInfo GetGlyphInfoSys(Font font, int chr) FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT) == 0) { FT_Glyph_Metrics& m = face->glyph->metrics; int left = FLOOR(m.horiBearingX); - int width = TRUNC(CEIL(m.horiBearingX + m.width) - left); + int width = TRUNC(CEIL(m.horiBearingX + m.width) - left); gi.width = TRUNC(ROUND(face->glyph->advance.x)); gi.lspc = TRUNC(left); gi.rspc = gi.width - width - gi.lspc; diff --git a/uppsrc/Draw/FontWin32.cpp b/uppsrc/Draw/FontWin32.cpp index 8c403eb99..8df9cc72d 100644 --- a/uppsrc/Draw/FontWin32.cpp +++ b/uppsrc/Draw/FontWin32.cpp @@ -173,6 +173,10 @@ static int CALLBACK Win32_AddFace(const LOGFONT *logfont, const TEXTMETRIC *, dw f.info = Font::SCALEABLE; if((logfont->lfPitchAndFamily & 3) == FIXED_PITCH) f.info |= Font::FIXEDPITCH; + if(logfont->lfPitchAndFamily & FF_ROMAN) + f.info |= Font::SERIFSTYLE; + if(logfont->lfPitchAndFamily & FF_SCRIPT) + f.info |= Font::SCRIPTSTYLE; if(!(type & TRUETYPE_FONTTYPE)) f.info &= ~Font::SCALEABLE; if(logfont->lfCharSet == SYMBOL_CHARSET || logfont->lfCharSet == OEM_CHARSET) diff --git a/uppsrc/Draw/src.tpp/Font_en-us.tpp b/uppsrc/Draw/src.tpp/Font_en-us.tpp index 08893e2df..cc439d865 100644 --- a/uppsrc/Draw/src.tpp/Font_en-us.tpp +++ b/uppsrc/Draw/src.tpp/Font_en-us.tpp @@ -337,6 +337,14 @@ there is a space inside the cell not used for glyph.&] [s2;%% True if font is mono`-spaced.&] [s3; &] [s4; &] +[s5;:Upp`:`:Font`:`:IsSerif`(`)const: [@(0.0.255) bool]_[* IsSerif]()_[@(0.0.255) const]&] +[s2;%% True if font has serif style.&] +[s3; &] +[s4; &] +[s5;:Upp`:`:Font`:`:IsScript`(`)const: [@(0.0.255) bool]_[* IsScript]()_[@(0.0.255) const]&] +[s2;%% True if font has script style.&] +[s3; &] +[s4; &] [s5;:Font`:`:IsScaleable`(`)const: [@(0.0.255) bool]_[* IsScaleable]()_[@(0.0.255) const]&] [s2;%% True if font is freely scaleable.&] [s3; &]