And migrated the IDWriteFont -> uiFontDescriptor code.
This commit is contained in:
parent
1f61fb30de
commit
86264d32a0
|
@ -665,22 +665,3 @@ void caretDrawParams(uiDrawContext *c, double height, struct caretDrawParams *p)
|
|||
// and there doesn't seem to be this either... (TODO check what PadWrite does?)
|
||||
p->xoff = 0;
|
||||
}
|
||||
|
||||
// TODO split this and the above related font matching code into a separate file?
|
||||
void fontdescFromIDWriteFont(IDWriteFont *font, uiDrawFontDescriptor *uidesc)
|
||||
{
|
||||
DWRITE_FONT_STYLE dwitalic;
|
||||
DWRITE_FONT_STRETCH dwstretch;
|
||||
|
||||
dwitalic = font->GetStyle();
|
||||
// TODO reverse the above misalignment if it is corrected
|
||||
uidesc->Weight = (uiDrawTextWeight) (font->GetWeight());
|
||||
dwstretch = font->GetStretch();
|
||||
|
||||
for (uidesc->Italic = uiDrawTextItalicNormal; uidesc->Italic < uiDrawTextItalicItalic; uidesc->Italic++)
|
||||
if (dwriteItalics[uidesc->Italic] == dwitalic)
|
||||
break;
|
||||
for (uidesc->Stretch = uiDrawTextStretchUltraCondensed; uidesc->Stretch < uiDrawTextStretchUltraExpanded; uidesc->Stretch++)
|
||||
if (dwriteStretches[uidesc->Stretch] == dwstretch)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -131,12 +131,3 @@ public:
|
|||
return true;
|
||||
}
|
||||
};
|
||||
// TODO these should not be exported
|
||||
extern std::map<uiDrawTextItalic, DWRITE_FONT_STYLE> dwriteItalics;
|
||||
extern std::map<uiDrawTextStretch, DWRITE_FONT_STRETCH> dwriteStretches;
|
||||
|
||||
// drawtext.cpp
|
||||
extern void fontdescFromIDWriteFont(IDWriteFont *font, uiDrawFontDescriptor *uidesc);
|
||||
|
||||
// opentype.cpp
|
||||
extern IDWriteTypography *otfToDirectWrite(const uiOpenTypeFeatures *otf);
|
||||
|
|
|
@ -10,3 +10,4 @@ extern IDWriteTypography *uiprivOpenTypeFeaturesToIDWriteTypography(const uiOpen
|
|||
extern DWRITE_FONT_WEIGHT uiprivWeightToDWriteWeight(uiTextWeight w);
|
||||
extern DWRITE_FONT_STYLE uiprivItalicToDWriteStyle(uiTextItalic i);
|
||||
extern DWRITE_FONT_STRETCH uiprivStretchToDWriteStretch(uiTextStretch s);
|
||||
extern void uiprivFontDescriptorFromIDWriteFont(IDWriteFont *font, uiDrawFontDescriptor *uidesc);
|
||||
|
|
|
@ -41,3 +41,21 @@ DWRITE_FONT_STRETCH uiprivStretchToDWriteStretch(uiTextStretch s)
|
|||
{
|
||||
return dwriteStretches[s];
|
||||
}
|
||||
|
||||
void uiprivFontDescriptorFromIDWriteFont(IDWriteFont *font, uiDrawFontDescriptor *uidesc)
|
||||
{
|
||||
DWRITE_FONT_STYLE dwitalic;
|
||||
DWRITE_FONT_STRETCH dwstretch;
|
||||
|
||||
dwitalic = font->GetStyle();
|
||||
// TODO reverse the above misalignment if it is corrected
|
||||
uidesc->Weight = (uiDrawTextWeight) (font->GetWeight());
|
||||
dwstretch = font->GetStretch();
|
||||
|
||||
for (uidesc->Italic = uiDrawTextItalicNormal; uidesc->Italic < uiDrawTextItalicItalic; uidesc->Italic++)
|
||||
if (dwriteItalics[uidesc->Italic] == dwitalic)
|
||||
break;
|
||||
for (uidesc->Stretch = uiDrawTextStretchUltraCondensed; uidesc->Stretch < uiDrawTextStretchUltraExpanded; uidesc->Stretch++)
|
||||
if (dwriteStretches[uidesc->Stretch] == dwstretch)
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue