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);
|
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
|
// 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
|
// And fortunately, unlike the traits (see below), unmatched features are simply ignored without affecting the other features :D
|
||||||
static void addFontSmallCapsAttr(CFMutableDictionaryRef attr)
|
static void addFontSmallCapsAttr(CFMutableDictionaryRef attr)
|
||||||
|
@ -118,6 +120,7 @@ static void addFontSmallCapsAttr(CFMutableDictionaryRef attr)
|
||||||
CFDictionaryAddValue(attr, kCTFontFeatureSettingsAttribute, outerArray);
|
CFDictionaryAddValue(attr, kCTFontFeatureSettingsAttribute, outerArray);
|
||||||
CFRelease(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 :(
|
// 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.
|
// 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);
|
cfdesc = CTFontDescriptorCreateWithAttributes(attr);
|
||||||
// TODO release attr?
|
// TODO release attr?
|
||||||
cfdesc = matchTraits(cfdesc, desc->Weight, desc->Italic, desc->Stretch);
|
cfdesc = matchTraits(cfdesc, desc->Weight, desc->Italic, desc->Stretch);
|
||||||
|
/*TODO
|
||||||
attr = extractAttributes(cfdesc);
|
attr = extractAttributes(cfdesc);
|
||||||
CFRelease(cfdesc);
|
CFRelease(cfdesc);
|
||||||
|
|
||||||
// and finally add the other attributes
|
|
||||||
if (desc->SmallCaps)
|
|
||||||
addFontSmallCapsAttr(attr);
|
|
||||||
|
|
||||||
// and NOW create the final descriptor
|
// and NOW create the final descriptor
|
||||||
cfdesc = CTFontDescriptorCreateWithAttributes(attr);
|
cfdesc = CTFontDescriptorCreateWithAttributes(attr);
|
||||||
// TODO release attr?
|
// TODO release attr?
|
||||||
|
*/
|
||||||
// specify the initial size again just to be safe
|
// specify the initial size again just to be safe
|
||||||
font->f = CTFontCreateWithFontDescriptor(cfdesc, desc->Size, NULL);
|
font->f = CTFontCreateWithFontDescriptor(cfdesc, desc->Size, NULL);
|
||||||
// TODO release cfdesc?
|
// TODO release cfdesc?
|
||||||
|
|
1
ui.h
1
ui.h
|
@ -496,7 +496,6 @@ struct uiDrawTextFontDescriptor {
|
||||||
double Size;
|
double Size;
|
||||||
uiDrawTextWeight Weight;
|
uiDrawTextWeight Weight;
|
||||||
uiDrawTextItalic Italic;
|
uiDrawTextItalic Italic;
|
||||||
int SmallCaps;
|
|
||||||
uiDrawTextStretch Stretch;
|
uiDrawTextStretch Stretch;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,7 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
||||||
{
|
{
|
||||||
uiDrawTextFont *font;
|
uiDrawTextFont *font;
|
||||||
PangoFontDescription *pdesc;
|
PangoFontDescription *pdesc;
|
||||||
PangoVariant variant;
|
//TODO PangoVariant variant;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
|
|
||||||
font = uiNew(uiDrawTextFont);
|
font = uiNew(uiDrawTextFont);
|
||||||
|
@ -543,10 +543,13 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
||||||
pangoWeights[desc->Weight]);
|
pangoWeights[desc->Weight]);
|
||||||
pango_font_description_set_style(pdesc,
|
pango_font_description_set_style(pdesc,
|
||||||
pangoItalics[desc->Italic]);
|
pangoItalics[desc->Italic]);
|
||||||
|
#if 0
|
||||||
|
TODO
|
||||||
variant = PANGO_VARIANT_NORMAL;
|
variant = PANGO_VARIANT_NORMAL;
|
||||||
if (desc->SmallCaps)
|
if (desc->SmallCaps)
|
||||||
variant = PANGO_VARIANT_SMALL_CAPS;
|
variant = PANGO_VARIANT_SMALL_CAPS;
|
||||||
pango_font_description_set_variant(pdesc, variant);
|
pango_font_description_set_variant(pdesc, variant);
|
||||||
|
#endif
|
||||||
pango_font_description_set_stretch(pdesc,
|
pango_font_description_set_stretch(pdesc,
|
||||||
pangoStretches[desc->Stretch]);
|
pangoStretches[desc->Stretch]);
|
||||||
|
|
||||||
|
|
|
@ -172,8 +172,6 @@ uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
|
||||||
if (!found)
|
if (!found)
|
||||||
complain("invalid initial stretch %d passed to uiDrawLoadClosestFont()", desc->Stretch);
|
complain("invalid initial stretch %d passed to uiDrawLoadClosestFont()", desc->Stretch);
|
||||||
|
|
||||||
// TODO small caps
|
|
||||||
|
|
||||||
hr = family->GetFirstMatchingFont(weight,
|
hr = family->GetFirstMatchingFont(weight,
|
||||||
stretch,
|
stretch,
|
||||||
italic,
|
italic,
|
||||||
|
@ -321,7 +319,6 @@ uiDrawTextLayout *uiDrawNewTextLayout(const char *text, uiDrawTextFont *defaultF
|
||||||
&(layout->format));
|
&(layout->format));
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
logHRESULT("error creating IDWriteTextFormat in uiDrawNewTextLayout()", hr);
|
logHRESULT("error creating IDWriteTextFormat in uiDrawNewTextLayout()", hr);
|
||||||
// TODO small caps
|
|
||||||
|
|
||||||
layout->bytesToCharacters = toUTF16Offsets(text, &wtext, &wlen);
|
layout->bytesToCharacters = toUTF16Offsets(text, &wtext, &wlen);
|
||||||
hr = dwfactory->CreateTextLayout(wtext, wlen,
|
hr = dwfactory->CreateTextLayout(wtext, wlen,
|
||||||
|
|
Loading…
Reference in New Issue