Some more text API changes.

This commit is contained in:
Pietro Gagliardi 2016-01-10 21:02:40 -05:00
parent 5f1b900dc5
commit 980f5a7419
1 changed files with 14 additions and 36 deletions

50
ui.h
View File

@ -442,15 +442,20 @@ _UI_EXTERN void uiDrawClip(uiDrawContext *c, uiDrawPath *path);
_UI_EXTERN void uiDrawSave(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;
_UI_EXTERN uiDrawFontFamilies *uiDrawListFontFamilies(void);
_UI_EXTERN uintmax_t uiDrawFontFamiliesNumFamilies(uiDrawFontFamilies *ff);
_UI_EXTERN char *uiDrawFontFamiliesFamily(uiDrawFontFamilies *ff, uintmax_t n);
_UI_EXTERN void uiDrawFreeFontFamilies(uiDrawFontFamilies *ff);
///// END TODO
typedef struct uiDrawTextLayout uiDrawTextLayout;
typedef struct uiDrawInitialTextStyle uiDrawInitialTextStyle;
typedef struct uiDrawTextFont uiDrawTextFont;
typedef struct uiDrawTextFontDescriptor uiDrawTextFontDescriptor;
typedef enum uiDrawTextWeight {
uiDrawTextWeightThin,
@ -493,8 +498,7 @@ typedef enum uiDrawTextGravity {
uiDrawTextGravityAuto,
} uiDrawTextGravity;
// TODO should this be renamed to uiDrawTextFontDescription? and should a pre-matched uiDrawTextFont be used for the initialStyle instead?
struct uiDrawInitialTextStyle {
struct uiDrawTextFontDescriptor {
const char *Family;
double Size;
uiDrawTextWeight Weight;
@ -504,43 +508,17 @@ struct uiDrawInitialTextStyle {
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...
_UI_EXTERN double uiDrawTextSizeToPoints(double textSize);
_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 uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);