Removed uiFontDescriptor.SmallCaps; on Windows this has to be applied to layouts.
This commit is contained in:
parent
9b27e12cfc
commit
23ec771c86
|
@ -76,6 +76,8 @@ static void addFontSizeAttr(CFMutableDictionaryRef attr, double size)
|
|||
CFRelease(n);
|
||||
}
|
||||
|
||||
#if 0
|
||||
TODO
|
||||
// See http://stackoverflow.com/questions/4810409/does-coretext-support-small-caps/4811371#4811371 and https://git.gnome.org/browse/pango/tree/pango/pangocoretext-fontmap.c for what these do
|
||||
// And fortunately, unlike the traits (see below), unmatched features are simply ignored without affecting the other features :D
|
||||
static void addFontSmallCapsAttr(CFMutableDictionaryRef attr)
|
||||
|
@ -118,6 +120,7 @@ static void addFontSmallCapsAttr(CFMutableDictionaryRef attr)
|
|||
CFDictionaryAddValue(attr, kCTFontFeatureSettingsAttribute, outerArray);
|
||||
CFRelease(outerArray);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Named constants for these were NOT added until 10.11, and even then they were added as external symbols instead of macros, so we can't use them directly :(
|
||||
// kode54 got these for me before I had access to El Capitan; thanks to him.
|
||||
|
@ -376,17 +379,14 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
|||
cfdesc = CTFontDescriptorCreateWithAttributes(attr);
|
||||
// TODO release attr?
|
||||
cfdesc = matchTraits(cfdesc, desc->Weight, desc->Italic, desc->Stretch);
|
||||
/*TODO
|
||||
attr = extractAttributes(cfdesc);
|
||||
CFRelease(cfdesc);
|
||||
|
||||
// and finally add the other attributes
|
||||
if (desc->SmallCaps)
|
||||
addFontSmallCapsAttr(attr);
|
||||
|
||||
// and NOW create the final descriptor
|
||||
cfdesc = CTFontDescriptorCreateWithAttributes(attr);
|
||||
// TODO release attr?
|
||||
|
||||
*/
|
||||
// specify the initial size again just to be safe
|
||||
font->f = CTFontCreateWithFontDescriptor(cfdesc, desc->Size, NULL);
|
||||
// TODO release cfdesc?
|
||||
|
|
1
ui.h
1
ui.h
|
@ -496,7 +496,6 @@ struct uiDrawTextFontDescriptor {
|
|||
double Size;
|
||||
uiDrawTextWeight Weight;
|
||||
uiDrawTextItalic Italic;
|
||||
int SmallCaps;
|
||||
uiDrawTextStretch Stretch;
|
||||
};
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
|||
{
|
||||
uiDrawTextFont *font;
|
||||
PangoFontDescription *pdesc;
|
||||
PangoVariant variant;
|
||||
//TODO PangoVariant variant;
|
||||
PangoContext *context;
|
||||
|
||||
font = uiNew(uiDrawTextFont);
|
||||
|
@ -543,10 +543,13 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
|||
pangoWeights[desc->Weight]);
|
||||
pango_font_description_set_style(pdesc,
|
||||
pangoItalics[desc->Italic]);
|
||||
#if 0
|
||||
TODO
|
||||
variant = PANGO_VARIANT_NORMAL;
|
||||
if (desc->SmallCaps)
|
||||
variant = PANGO_VARIANT_SMALL_CAPS;
|
||||
pango_font_description_set_variant(pdesc, variant);
|
||||
#endif
|
||||
pango_font_description_set_stretch(pdesc,
|
||||
pangoStretches[desc->Stretch]);
|
||||
|
||||
|
|
|
@ -172,8 +172,6 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
|||
if (!found)
|
||||
complain("invalid initial stretch %d passed to uiDrawLoadClosestFont()", desc->Stretch);
|
||||
|
||||
// TODO small caps
|
||||
|
||||
hr = family->GetFirstMatchingFont(weight,
|
||||
stretch,
|
||||
italic,
|
||||
|
@ -321,7 +319,6 @@ uiDrawTextLayout *uiDrawNewTextLayout(const char *text, uiDrawTextFont *defaultF
|
|||
&(layout->format));
|
||||
if (hr != S_OK)
|
||||
logHRESULT("error creating IDWriteTextFormat in uiDrawNewTextLayout()", hr);
|
||||
// TODO small caps
|
||||
|
||||
layout->bytesToCharacters = toUTF16Offsets(text, &wtext, &wlen);
|
||||
hr = dwfactory->CreateTextLayout(wtext, wlen,
|
||||
|
|
Loading…
Reference in New Issue