Fixed build errors, some of which were overisghts and others were habits from the OS X code.
This commit is contained in:
parent
697c926c92
commit
602060a673
|
@ -11,19 +11,6 @@ struct foreachParams {
|
||||||
GPtrArray *backgroundParams;
|
GPtrArray *backgroundParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void backgroundClosure(uiDrawContext *c, uiDrawTextLayout *layout, double x, double y, gpointer data)
|
|
||||||
{
|
|
||||||
struct closureParams *p = (struct closureParams *) data;
|
|
||||||
uiDrawBrush brush;
|
|
||||||
|
|
||||||
brush.Type = uiDrawBrushTypeSolid;
|
|
||||||
brush.R = p->r;
|
|
||||||
brush.G = p->g;
|
|
||||||
brush.B = p->b;
|
|
||||||
brush.A = p->a;
|
|
||||||
//TODO drawTextBackground(c, x, y, layout, p->start, p->end, &brush, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void addBackgroundAttribute(struct foreachParams *p, size_t start, size_t end, double r, double g, double b, double a)
|
static void addBackgroundAttribute(struct foreachParams *p, size_t start, size_t end, double r, double g, double b, double a)
|
||||||
{
|
{
|
||||||
uiprivDrawTextBackgroundParams *dtb;
|
uiprivDrawTextBackgroundParams *dtb;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 11 march 2018
|
// 11 march 2018
|
||||||
#import "../common/attrstr.h"
|
#include "../common/attrstr.h"
|
||||||
|
|
||||||
// See https://developer.gnome.org/pango/1.30/pango-Cairo-Rendering.html#pango-Cairo-Rendering.description
|
// See https://developer.gnome.org/pango/1.30/pango-Cairo-Rendering.html#pango-Cairo-Rendering.description
|
||||||
// For the conversion, see https://developer.gnome.org/pango/1.30/pango-Glyph-Storage.html#pango-units-to-double and https://developer.gnome.org/pango/1.30/pango-Glyph-Storage.html#pango-units-from-double
|
// For the conversion, see https://developer.gnome.org/pango/1.30/pango-Glyph-Storage.html#pango-units-to-double and https://developer.gnome.org/pango/1.30/pango-Glyph-Storage.html#pango-units-from-double
|
||||||
|
@ -14,7 +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);
|
extern void uiprivFontDescriptorFromPangoFontDescription(PangoFontDescription *pdesc, uiFontDescriptor *uidesc);
|
||||||
|
|
||||||
// attrstr.c
|
// attrstr.c
|
||||||
extern PangoAttrList *uiprivAttributedStringToPangoAttrList(uiDrawTextLayoutParams *p, GPtrArray **backgroundParams);
|
extern PangoAttrList *uiprivAttributedStringToPangoAttrList(uiDrawTextLayoutParams *p, GPtrArray **backgroundParams);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 11 march 2018
|
// 11 march 2018
|
||||||
#import "uipriv_unix.h"
|
#include "uipriv_unix.h"
|
||||||
#import "draw.h"
|
#include "draw.h"
|
||||||
#import "attrstr.h"
|
#include "attrstr.h"
|
||||||
|
|
||||||
struct uiDrawTextLayout {
|
struct uiDrawTextLayout {
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
|
@ -51,7 +51,7 @@ uiDrawTextLayout *uiDrawNewTextLayout(uiDrawTextLayoutParams *p)
|
||||||
|
|
||||||
pango_layout_set_alignment(tl->layout, pangoAligns[p->Align]);
|
pango_layout_set_alignment(tl->layout, pangoAligns[p->Align]);
|
||||||
|
|
||||||
attrs = uiprivAttributedStringToPangoAttrList(p, &(tl->backgroundFeatures));
|
attrs = uiprivAttributedStringToPangoAttrList(p, &(tl->backgroundParams));
|
||||||
pango_layout_set_attributes(tl->layout, attrs);
|
pango_layout_set_attributes(tl->layout, attrs);
|
||||||
pango_attr_list_unref(attrs);
|
pango_attr_list_unref(attrs);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ uiDrawTextLayout *uiDrawNewTextLayout(uiDrawTextLayoutParams *p)
|
||||||
|
|
||||||
void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
|
void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
|
||||||
{
|
{
|
||||||
g_ptr_array_unref(tl->backgroundFeatures);
|
g_ptr_array_unref(tl->backgroundParams);
|
||||||
g_object_unref(tl->layout);
|
g_object_unref(tl->layout);
|
||||||
uiprivFree(tl);
|
uiprivFree(tl);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 0; i < tl->backgroundFeatures->len; i++) {
|
for (i = 0; i < tl->backgroundParams->len; i++) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
// TODO have an implicit save/restore on each drawing functions instead? and is this correct?
|
// TODO have an implicit save/restore on each drawing functions instead? and is this correct?
|
||||||
|
|
|
@ -27,7 +27,7 @@ static void defaultOnChanged(uiFontButton *b, void *data)
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiFontButtonFont(uiFontButton *b, uiDrawFontDescriptor *desc)
|
void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc)
|
||||||
{
|
{
|
||||||
PangoFontDescription *pdesc;
|
PangoFontDescription *pdesc;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ PangoStretch uiprivStretchToPangoStretch(uiTextStretch s)
|
||||||
|
|
||||||
PangoFontDescription *uiprivFontDescriptorToPangoFontDescription(const uiFontDescriptor *uidesc)
|
PangoFontDescription *uiprivFontDescriptorToPangoFontDescription(const uiFontDescriptor *uidesc)
|
||||||
{
|
{
|
||||||
PangoFontDescriptor *desc;
|
PangoFontDescription *desc;
|
||||||
|
|
||||||
desc = pango_font_description_new();
|
desc = pango_font_description_new();
|
||||||
pango_font_description_set_family(desc, uidesc->Family);
|
pango_font_description_set_family(desc, uidesc->Family);
|
||||||
|
@ -54,7 +54,7 @@ PangoFontDescription *uiprivFontDescriptorToPangoFontDescription(const uiFontDes
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiprivFontDescriptorFromPangoFontDescription(PangoFontDescription *pdesc, uiDrawFontDescriptor *uidesc)
|
void uiprivFontDescriptorFromPangoFontDescription(PangoFontDescription *pdesc, uiFontDescriptor *uidesc)
|
||||||
{
|
{
|
||||||
PangoStyle pitalic;
|
PangoStyle pitalic;
|
||||||
PangoStretch pstretch;
|
PangoStretch pstretch;
|
||||||
|
@ -67,10 +67,10 @@ void uiprivFontDescriptorFromPangoFontDescription(PangoFontDescription *pdesc, u
|
||||||
// absolute size does not matter because, as above, 1 device unit == 1 cairo point
|
// 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));
|
uidesc->Size = pango_units_to_double(pango_font_description_get_size(pdesc));
|
||||||
|
|
||||||
for (uidesc->Italic = uiDrawTextItalicNormal; uidesc->Italic < uiDrawTextItalicItalic; uidesc->Italic++)
|
for (uidesc->Italic = uiTextItalicNormal; uidesc->Italic < uiTextItalicItalic; uidesc->Italic++)
|
||||||
if (pangoItalics[uidesc->Italic] == pitalic)
|
if (pangoItalics[uidesc->Italic] == pitalic)
|
||||||
break;
|
break;
|
||||||
for (uidesc->Stretch = uiDrawTextStretchUltraCondensed; uidesc->Stretch < uiDrawTextStretchUltraExpanded; uidesc->Stretch++)
|
for (uidesc->Stretch = uiTextStretchUltraCondensed; uidesc->Stretch < uiTextStretchUltraExpanded; uidesc->Stretch++)
|
||||||
if (pangoStretches[uidesc->Stretch] == pstretch)
|
if (pangoStretches[uidesc->Stretch] == pstretch)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,3 @@ extern void loadFutures(void);
|
||||||
extern PangoAttribute *FUTURE_pango_attr_font_features_new(const gchar *features);
|
extern PangoAttribute *FUTURE_pango_attr_font_features_new(const gchar *features);
|
||||||
extern PangoAttribute *FUTURE_pango_attr_foreground_alpha_new(guint16 alpha);
|
extern PangoAttribute *FUTURE_pango_attr_foreground_alpha_new(guint16 alpha);
|
||||||
extern gboolean FUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name);
|
extern gboolean FUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name);
|
||||||
|
|
||||||
// drawtext.c
|
|
||||||
extern void fontdescFromPangoFontDescription(PangoFontDescription *pdesc, uiDrawFontDescriptor *uidesc);
|
|
||||||
|
|
Loading…
Reference in New Issue