And migrated fontmatch.c back. Let's test.
This commit is contained in:
parent
5939c3203d
commit
697c926c92
|
@ -225,25 +225,3 @@ void caretDrawParams(uiDrawContext *c, double height, struct caretDrawParams *p)
|
||||||
p->xoff = xoff;
|
p->xoff = xoff;
|
||||||
p->width = width;
|
p->width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO split this and the other font description stuff into their own file?
|
|
||||||
void fontdescFromPangoFontDescription(PangoFontDescription *pdesc, uiDrawFontDescriptor *uidesc)
|
|
||||||
{
|
|
||||||
PangoStyle pitalic;
|
|
||||||
PangoStretch pstretch;
|
|
||||||
|
|
||||||
uidesc->Family = uiUnixStrdupText(pango_font_description_get_family(pdesc));
|
|
||||||
pitalic = pango_font_description_get_style(pdesc);
|
|
||||||
// TODO reverse the above misalignment if it is corrected
|
|
||||||
uidesc->Weight = pango_font_description_get_weight(pdesc);
|
|
||||||
pstretch = pango_font_description_get_stretch(pdesc);
|
|
||||||
// absolute size does not matter because, as above, 1 device unit == 1 cairo point
|
|
||||||
uidesc->Size = pango_units_to_double(pango_font_description_get_size(pdesc));
|
|
||||||
|
|
||||||
for (uidesc->Italic = uiDrawTextItalicNormal; uidesc->Italic < uiDrawTextItalicItalic; uidesc->Italic++)
|
|
||||||
if (pangoItalics[uidesc->Italic] == pitalic)
|
|
||||||
break;
|
|
||||||
for (uidesc->Stretch = uiDrawTextStretchUltraCondensed; uidesc->Stretch < uiDrawTextStretchUltraExpanded; uidesc->Stretch++)
|
|
||||||
if (pangoStretches[uidesc->Stretch] == pstretch)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ extern PangoWeight uiprivWeightToPangoWeight(uiTextWeight w);
|
||||||
extern PangoStyle uiprivItalicToPangoStyle(uiTextItalic i);
|
extern PangoStyle uiprivItalicToPangoStyle(uiTextItalic i);
|
||||||
extern PangoStretch uiprivStretchToPangoStretch(uiTextStretch s);
|
extern PangoStretch uiprivStretchToPangoStretch(uiTextStretch s);
|
||||||
extern PangoFontDescription *uiprivFontDescriptorToPangoFontDescription(const uiFontDescriptor *uidesc);
|
extern PangoFontDescription *uiprivFontDescriptorToPangoFontDescription(const uiFontDescriptor *uidesc);
|
||||||
|
extern void uiprivFontDescriptorFromPangoFontDescription(PangoFontDescription *pdesc, uiDrawFontDescriptor *uidesc);
|
||||||
|
|
||||||
// attrstr.c
|
// attrstr.c
|
||||||
extern PangoAttrList *uiprivAttributedStringToPangoAttrList(uiDrawTextLayoutParams *p, GPtrArray **backgroundParams);
|
extern PangoAttrList *uiprivAttributedStringToPangoAttrList(uiDrawTextLayoutParams *p, GPtrArray **backgroundParams);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// 14 april 2016
|
// 14 april 2016
|
||||||
#include "uipriv_unix.h"
|
#include "uipriv_unix.h"
|
||||||
|
#include "attrstr.h"
|
||||||
|
|
||||||
struct uiFontButton {
|
struct uiFontButton {
|
||||||
uiUnixControl c;
|
uiUnixControl c;
|
||||||
|
@ -31,8 +32,8 @@ void uiFontButtonFont(uiFontButton *b, uiDrawFontDescriptor *desc)
|
||||||
PangoFontDescription *pdesc;
|
PangoFontDescription *pdesc;
|
||||||
|
|
||||||
pdesc = gtk_font_chooser_get_font_desc(b->fc);
|
pdesc = gtk_font_chooser_get_font_desc(b->fc);
|
||||||
fontdescFromPangoFontDescription(pdesc, desc);
|
uiprivFontDescriptorFromPangoFontDescription(pdesc, desc);
|
||||||
// desc is transfer-full and thus is a copy
|
// pdesc is transfer-full and thus is a copy
|
||||||
pango_font_description_free(pdesc);
|
pango_font_description_free(pdesc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,3 +53,24 @@ PangoFontDescription *uiprivFontDescriptorToPangoFontDescription(const uiFontDes
|
||||||
pango_font_description_set_stretch(desc, uiprivStretchToPangoStretch(uidesc->Stretch));
|
pango_font_description_set_stretch(desc, uiprivStretchToPangoStretch(uidesc->Stretch));
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiprivFontDescriptorFromPangoFontDescription(PangoFontDescription *pdesc, uiDrawFontDescriptor *uidesc)
|
||||||
|
{
|
||||||
|
PangoStyle pitalic;
|
||||||
|
PangoStretch pstretch;
|
||||||
|
|
||||||
|
uidesc->Family = uiUnixStrdupText(pango_font_description_get_family(pdesc));
|
||||||
|
pitalic = pango_font_description_get_style(pdesc);
|
||||||
|
// TODO reverse the above misalignment if it is corrected
|
||||||
|
uidesc->Weight = pango_font_description_get_weight(pdesc);
|
||||||
|
pstretch = pango_font_description_get_stretch(pdesc);
|
||||||
|
// absolute size does not matter because, as above, 1 device unit == 1 cairo point
|
||||||
|
uidesc->Size = pango_units_to_double(pango_font_description_get_size(pdesc));
|
||||||
|
|
||||||
|
for (uidesc->Italic = uiDrawTextItalicNormal; uidesc->Italic < uiDrawTextItalicItalic; uidesc->Italic++)
|
||||||
|
if (pangoItalics[uidesc->Italic] == pitalic)
|
||||||
|
break;
|
||||||
|
for (uidesc->Stretch = uiDrawTextStretchUltraCondensed; uidesc->Stretch < uiDrawTextStretchUltraExpanded; uidesc->Stretch++)
|
||||||
|
if (pangoStretches[uidesc->Stretch] == pstretch)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue