Some more text API changes.
This commit is contained in:
parent
5f1b900dc5
commit
980f5a7419
50
ui.h
50
ui.h
|
@ -442,15 +442,20 @@ _UI_EXTERN void uiDrawClip(uiDrawContext *c, uiDrawPath *path);
|
||||||
_UI_EXTERN void uiDrawSave(uiDrawContext *c);
|
_UI_EXTERN void uiDrawSave(uiDrawContext *c);
|
||||||
_UI_EXTERN void uiDrawRestore(uiDrawContext *c);
|
_UI_EXTERN void uiDrawRestore(uiDrawContext *c);
|
||||||
|
|
||||||
|
// TODO manage the use of Text, Font, and TextFont, and of the uiDrawText prefix in general
|
||||||
|
|
||||||
|
///// TODO
|
||||||
typedef struct uiDrawFontFamilies uiDrawFontFamilies;
|
typedef struct uiDrawFontFamilies uiDrawFontFamilies;
|
||||||
|
|
||||||
_UI_EXTERN uiDrawFontFamilies *uiDrawListFontFamilies(void);
|
_UI_EXTERN uiDrawFontFamilies *uiDrawListFontFamilies(void);
|
||||||
_UI_EXTERN uintmax_t uiDrawFontFamiliesNumFamilies(uiDrawFontFamilies *ff);
|
_UI_EXTERN uintmax_t uiDrawFontFamiliesNumFamilies(uiDrawFontFamilies *ff);
|
||||||
_UI_EXTERN char *uiDrawFontFamiliesFamily(uiDrawFontFamilies *ff, uintmax_t n);
|
_UI_EXTERN char *uiDrawFontFamiliesFamily(uiDrawFontFamilies *ff, uintmax_t n);
|
||||||
_UI_EXTERN void uiDrawFreeFontFamilies(uiDrawFontFamilies *ff);
|
_UI_EXTERN void uiDrawFreeFontFamilies(uiDrawFontFamilies *ff);
|
||||||
|
///// END TODO
|
||||||
|
|
||||||
typedef struct uiDrawTextLayout uiDrawTextLayout;
|
typedef struct uiDrawTextLayout uiDrawTextLayout;
|
||||||
typedef struct uiDrawInitialTextStyle uiDrawInitialTextStyle;
|
typedef struct uiDrawTextFont uiDrawTextFont;
|
||||||
|
typedef struct uiDrawTextFontDescriptor uiDrawTextFontDescriptor;
|
||||||
|
|
||||||
typedef enum uiDrawTextWeight {
|
typedef enum uiDrawTextWeight {
|
||||||
uiDrawTextWeightThin,
|
uiDrawTextWeightThin,
|
||||||
|
@ -493,8 +498,7 @@ typedef enum uiDrawTextGravity {
|
||||||
uiDrawTextGravityAuto,
|
uiDrawTextGravityAuto,
|
||||||
} uiDrawTextGravity;
|
} uiDrawTextGravity;
|
||||||
|
|
||||||
// TODO should this be renamed to uiDrawTextFontDescription? and should a pre-matched uiDrawTextFont be used for the initialStyle instead?
|
struct uiDrawTextFontDescriptor {
|
||||||
struct uiDrawInitialTextStyle {
|
|
||||||
const char *Family;
|
const char *Family;
|
||||||
double Size;
|
double Size;
|
||||||
uiDrawTextWeight Weight;
|
uiDrawTextWeight Weight;
|
||||||
|
@ -504,43 +508,17 @@ struct uiDrawInitialTextStyle {
|
||||||
uiDrawTextGravity Gravity;
|
uiDrawTextGravity Gravity;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*TODO
|
|
||||||
struct uiDrawTextStyle {
|
|
||||||
const char *Family;
|
|
||||||
double Size;
|
|
||||||
uiDrawTextWeight Weight;
|
|
||||||
uiDrawTextItalic Italic;
|
|
||||||
int SmallCaps;
|
|
||||||
uiDrawTextStretch Stretch;
|
|
||||||
double TextR;
|
|
||||||
double TextG;
|
|
||||||
double TextB;
|
|
||||||
double TextA;
|
|
||||||
int HasBackground;
|
|
||||||
double BackgroundR;
|
|
||||||
double BackgroundG;
|
|
||||||
double BackgroundB;
|
|
||||||
double BackgroundA; // TODO Pango
|
|
||||||
int HasStrikethrough;
|
|
||||||
double StrikethroughR;
|
|
||||||
double StrikethroughG;
|
|
||||||
double StrikethroughB;
|
|
||||||
double StrikethroughA; // TODO Pango
|
|
||||||
int HasUnderline;
|
|
||||||
double UnderlineR;
|
|
||||||
double UnderlineG;
|
|
||||||
double UnderlineB;
|
|
||||||
double UnderlineA; // TODO Pango
|
|
||||||
const char *Language; // RFC 3066; NULL for default
|
|
||||||
// TODO other Pango attributes
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO wait why do I have these functions? I don't think they provide a correct line height...
|
// TODO wait why do I have these functions? I don't think they provide a correct line height...
|
||||||
_UI_EXTERN double uiDrawTextSizeToPoints(double textSize);
|
_UI_EXTERN double uiDrawTextSizeToPoints(double textSize);
|
||||||
_UI_EXTERN double uiDrawPointsToTextSize(double points);
|
_UI_EXTERN double uiDrawPointsToTextSize(double points);
|
||||||
|
|
||||||
_UI_EXTERN uiDrawTextLayout *uiDrawNewTextLayout(const char *text, const uiDrawInitialTextStyle *initialTextStyle);
|
_UI_EXTERN uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc);
|
||||||
|
_UI_EXTERN void uiDrawFreeTextFont(uiDrawTextFont *font);
|
||||||
|
_UI_EXTERN uintptr_t uiDrawTextFontHandle(uiDrawTextFont *font);
|
||||||
|
_UI_EXTERN void uiDrawTextFontDescribe(uiDrawTextFont *font, uiDrawTextFontDescriptor *desc);
|
||||||
|
// TODO make copy with given attributes methods?
|
||||||
|
|
||||||
|
_UI_EXTERN uiDrawTextLayout *uiDrawNewTextLayout(const char *text, uiDrawTextFont *defaultFont);
|
||||||
_UI_EXTERN void uiDrawFreeTextLayout(uiDrawTextLayout *layout);
|
_UI_EXTERN void uiDrawFreeTextLayout(uiDrawTextLayout *layout);
|
||||||
|
|
||||||
_UI_EXTERN void uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);
|
_UI_EXTERN void uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);
|
||||||
|
|
Loading…
Reference in New Issue