Aborted implementing text rendering for now.
This commit is contained in:
parent
601bced3ac
commit
640598f417
|
@ -0,0 +1,72 @@
|
||||||
|
// 15 september 2015
|
||||||
|
|
||||||
|
// TODO uiDrawBeginTextRGB(/RGBA?)
|
||||||
|
// might need something more flexible for attributed text
|
||||||
|
|
||||||
|
typedef struct uiDrawFont uiDrawFont;
|
||||||
|
typedef struct uiDrawFontSpec uiDrawFontSpec;
|
||||||
|
typedef struct uiDrawTextBlockParams uiDrawTextBlockParams;
|
||||||
|
typedef struct uiDrawFontMetrics uiDrawFontMetrics;
|
||||||
|
typedef enum uiDrawTextWeight uiDrawTextWeight;
|
||||||
|
typedef enum uiDrawTextAlign uiDrawTextAlign;
|
||||||
|
|
||||||
|
enum uiDrawTextWeight {
|
||||||
|
uiDrawTextWeightThin,
|
||||||
|
uiDrawTextWeightExtraLight,
|
||||||
|
uiDrawTextWeightLight,
|
||||||
|
uiDrawTextWeightNormal,
|
||||||
|
uiDrawTextWeightMedium,
|
||||||
|
uiDrawTextWeightSemiBold,
|
||||||
|
uiDrawTextWeightBold,
|
||||||
|
uiDrawTextWeightExtraBold,
|
||||||
|
uiDrawTextWeightHeavy,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uiDrawFontSpec {
|
||||||
|
const char *Family;
|
||||||
|
uintmax_t PointSize;
|
||||||
|
uiDrawTextWeight Weight;
|
||||||
|
int Italic; // always prefers true italics over obliques whenever possible
|
||||||
|
int Vertical;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum uiDrawTextAlign {
|
||||||
|
uiDrawTextAlignLeft,
|
||||||
|
uiDrawTextAlignCenter,
|
||||||
|
uiDrawTextAlignRight,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uiDrawTextBlockParams {
|
||||||
|
intmax_t Width;
|
||||||
|
intmax_t FirstLineIndent;
|
||||||
|
intmax_t LineSpacing;
|
||||||
|
uiDrawTextAlign Align;
|
||||||
|
int Justify;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uiDrawFontMetrics {
|
||||||
|
// TODO
|
||||||
|
// metrics on Windows are per-device; other platforms not?
|
||||||
|
};
|
||||||
|
|
||||||
|
#define uiDrawTextPixelSizeToPointSize(pix, dpiY) \
|
||||||
|
((uintmax_t) ((((double) (pix)) * 72.0) / ((double) (dpiY))))
|
||||||
|
#define uiDrawTextPointSizeToPixelSize(pt, dpiY) \
|
||||||
|
((uintmax_t) (((double) (pt)) * (((double) (dpiY)) / 72.0)))
|
||||||
|
|
||||||
|
uiDrawFont *uiDrawPrepareFont(uiDrawFontSpec *);
|
||||||
|
void uiDrawFreeFont(uiDrawFont *);
|
||||||
|
|
||||||
|
void uiDrawText(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t);
|
||||||
|
void uiDrawTextBlock(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t, uiDrawTextBlockParams *);
|
||||||
|
void uiDrawTextExtents(uiDrawContext *, const char *, uiDrawFont *, intmax_t *, intmax_t *);
|
||||||
|
intmax_t uiDrawTextExtentsBlockHeight(uiDrawContext *, const char *, uiDrawFont *, uiDrawTextBlockParams *);
|
||||||
|
// TODO width for number of lines
|
||||||
|
//TODOvoid uiDrawContextFontMetrics(uiDrawContext *, uiDrawFont *, uiDrawFontMetrics *);
|
||||||
|
|
||||||
|
// TODO draw text, single line, control font
|
||||||
|
// TODO draw text, wrapped to width, control font
|
||||||
|
// TODO get text extents, single line, control font
|
||||||
|
// TODO get text height for width, control font
|
||||||
|
// TODO width for number of lines, control font
|
||||||
|
// TODO get font metrics, control font
|
69
gtkarea/ui.h
69
gtkarea/ui.h
|
@ -76,7 +76,6 @@ struct uiDrawStrokeParams {
|
||||||
void uiDrawBeginPathRGB(uiDrawContext *, uint8_t, uint8_t, uint8_t);
|
void uiDrawBeginPathRGB(uiDrawContext *, uint8_t, uint8_t, uint8_t);
|
||||||
// TODO verify these aren't alpha premultiplied anywhere
|
// TODO verify these aren't alpha premultiplied anywhere
|
||||||
void uiDrawBeginPathRGBA(uiDrawContext *, uint8_t, uint8_t, uint8_t, uint8_t);
|
void uiDrawBeginPathRGBA(uiDrawContext *, uint8_t, uint8_t, uint8_t, uint8_t);
|
||||||
// TODO uiDrawBeginTextRGB(/RGBA?)
|
|
||||||
|
|
||||||
void uiDrawMoveTo(uiDrawContext *, intmax_t, intmax_t);
|
void uiDrawMoveTo(uiDrawContext *, intmax_t, intmax_t);
|
||||||
void uiDrawLineTo(uiDrawContext *, intmax_t, intmax_t);
|
void uiDrawLineTo(uiDrawContext *, intmax_t, intmax_t);
|
||||||
|
@ -95,74 +94,6 @@ void uiDrawFill(uiDrawContext *, uiDrawFillMode);
|
||||||
// - elliptical arcs
|
// - elliptical arcs
|
||||||
// - quadratic bezier curves
|
// - quadratic bezier curves
|
||||||
|
|
||||||
typedef struct uiDrawFont uiDrawFont;
|
|
||||||
typedef struct uiDrawFontSpec uiDrawFontSpec;
|
|
||||||
typedef struct uiDrawTextBlockParams uiDrawTextBlockParams;
|
|
||||||
typedef struct uiDrawFontMetrics uiDrawFontMetrics;
|
|
||||||
typedef enum uiDrawTextWeight uiDrawTextWeight;
|
|
||||||
typedef enum uiDrawTextAlign uiDrawTextAlign;
|
|
||||||
|
|
||||||
enum uiDrawTextWeight {
|
|
||||||
uiDrawTextWeightThin,
|
|
||||||
uiDrawTextWeightExtraLight,
|
|
||||||
uiDrawTextWeightLight,
|
|
||||||
uiDrawTextWeightNormal,
|
|
||||||
uiDrawTextWeightMedium,
|
|
||||||
uiDrawTextWeightSemiBold,
|
|
||||||
uiDrawTextWeightBold,
|
|
||||||
uiDrawTextWeightExtraBold,
|
|
||||||
uiDrawTextWeightHeavy,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawFontSpec {
|
|
||||||
const char *Family;
|
|
||||||
uintmax_t PointSize;
|
|
||||||
uiDrawTextWeight Weight;
|
|
||||||
int Italic; // always prefers true italics over obliques whenever possible
|
|
||||||
int Vertical;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum uiDrawTextAlign {
|
|
||||||
uiDrawTextAlignLeft,
|
|
||||||
uiDrawTextAlignCenter,
|
|
||||||
uiDrawTextAlignRight,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawTextBlockParams {
|
|
||||||
intmax_t Width;
|
|
||||||
intmax_t FirstLineIndent;
|
|
||||||
intmax_t LineSpacing;
|
|
||||||
uiDrawTextAlign Align;
|
|
||||||
int Justify;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawFontMetrics {
|
|
||||||
// TODO
|
|
||||||
// metrics on Windows are per-device; other platforms not?
|
|
||||||
};
|
|
||||||
|
|
||||||
#define uiDrawTextPixelSizeToPointSize(pix, dpiY) \
|
|
||||||
((uintmax_t) ((((double) (pix)) * 72.0) / ((double) (dpiY))))
|
|
||||||
#define uiDrawTextPointSizeToPixelSize(pt, dpiY) \
|
|
||||||
((uintmax_t) (((double) (pt)) * (((double) (dpiY)) / 72.0)))
|
|
||||||
|
|
||||||
uiDrawFont *uiDrawPrepareFont(uiDrawFontSpec *);
|
|
||||||
void uiDrawFreeFont(uiDrawFont *);
|
|
||||||
|
|
||||||
void uiDrawText(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t);
|
|
||||||
void uiDrawTextBlock(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t, uiDrawTextBlockParams *);
|
|
||||||
void uiDrawTextExtents(uiDrawContext *, const char *, uiDrawFont *, intmax_t *, intmax_t *);
|
|
||||||
intmax_t uiDrawTextExtentsBlockHeight(uiDrawContext *, const char *, uiDrawFont *, uiDrawTextBlockParams *);
|
|
||||||
// TODO width for number of lines
|
|
||||||
//TODOvoid uiDrawContextFontMetrics(uiDrawContext *, uiDrawFont *, uiDrawFontMetrics *);
|
|
||||||
|
|
||||||
// TODO draw text, single line, control font
|
|
||||||
// TODO draw text, wrapped to width, control font
|
|
||||||
// TODO get text extents, single line, control font
|
|
||||||
// TODO get text height for width, control font
|
|
||||||
// TODO width for number of lines, control font
|
|
||||||
// TODO get font metrics, control font
|
|
||||||
|
|
||||||
typedef enum uiModifiers uiModifiers;
|
typedef enum uiModifiers uiModifiers;
|
||||||
|
|
||||||
enum uiModifiers {
|
enum uiModifiers {
|
||||||
|
|
|
@ -76,7 +76,6 @@ struct uiDrawStrokeParams {
|
||||||
void uiDrawBeginPathRGB(uiDrawContext *, uint8_t, uint8_t, uint8_t);
|
void uiDrawBeginPathRGB(uiDrawContext *, uint8_t, uint8_t, uint8_t);
|
||||||
// TODO verify these aren't alpha premultiplied anywhere
|
// TODO verify these aren't alpha premultiplied anywhere
|
||||||
void uiDrawBeginPathRGBA(uiDrawContext *, uint8_t, uint8_t, uint8_t, uint8_t);
|
void uiDrawBeginPathRGBA(uiDrawContext *, uint8_t, uint8_t, uint8_t, uint8_t);
|
||||||
// TODO uiDrawBeginTextRGB(/RGBA?)
|
|
||||||
|
|
||||||
void uiDrawMoveTo(uiDrawContext *, intmax_t, intmax_t);
|
void uiDrawMoveTo(uiDrawContext *, intmax_t, intmax_t);
|
||||||
void uiDrawLineTo(uiDrawContext *, intmax_t, intmax_t);
|
void uiDrawLineTo(uiDrawContext *, intmax_t, intmax_t);
|
||||||
|
@ -95,74 +94,6 @@ void uiDrawFill(uiDrawContext *, uiDrawFillMode);
|
||||||
// - elliptical arcs
|
// - elliptical arcs
|
||||||
// - quadratic bezier curves
|
// - quadratic bezier curves
|
||||||
|
|
||||||
typedef struct uiDrawFont uiDrawFont;
|
|
||||||
typedef struct uiDrawFontSpec uiDrawFontSpec;
|
|
||||||
typedef struct uiDrawTextBlockParams uiDrawTextBlockParams;
|
|
||||||
typedef struct uiDrawFontMetrics uiDrawFontMetrics;
|
|
||||||
typedef enum uiDrawTextWeight uiDrawTextWeight;
|
|
||||||
typedef enum uiDrawTextAlign uiDrawTextAlign;
|
|
||||||
|
|
||||||
enum uiDrawTextWeight {
|
|
||||||
uiDrawTextWeightThin,
|
|
||||||
uiDrawTextWeightExtraLight,
|
|
||||||
uiDrawTextWeightLight,
|
|
||||||
uiDrawTextWeightNormal,
|
|
||||||
uiDrawTextWeightMedium,
|
|
||||||
uiDrawTextWeightSemiBold,
|
|
||||||
uiDrawTextWeightBold,
|
|
||||||
uiDrawTextWeightExtraBold,
|
|
||||||
uiDrawTextWeightHeavy,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawFontSpec {
|
|
||||||
const char *Family;
|
|
||||||
uintmax_t PointSize;
|
|
||||||
uiDrawTextWeight Weight;
|
|
||||||
int Italic; // always prefers true italics over obliques whenever possible
|
|
||||||
int Vertical;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum uiDrawTextAlign {
|
|
||||||
uiDrawTextAlignLeft,
|
|
||||||
uiDrawTextAlignCenter,
|
|
||||||
uiDrawTextAlignRight,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawTextBlockParams {
|
|
||||||
intmax_t Width;
|
|
||||||
intmax_t FirstLineIndent;
|
|
||||||
intmax_t LineSpacing;
|
|
||||||
uiDrawTextAlign Align;
|
|
||||||
int Justify;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawFontMetrics {
|
|
||||||
// TODO
|
|
||||||
// metrics on Windows are per-device; other platforms not?
|
|
||||||
};
|
|
||||||
|
|
||||||
#define uiDrawTextPixelSizeToPointSize(pix, dpiY) \
|
|
||||||
((uintmax_t) ((((double) (pix)) * 72.0) / ((double) (dpiY))))
|
|
||||||
#define uiDrawTextPointSizeToPixelSize(pt, dpiY) \
|
|
||||||
((uintmax_t) (((double) (pt)) * (((double) (dpiY)) / 72.0)))
|
|
||||||
|
|
||||||
uiDrawFont *uiDrawPrepareFont(uiDrawFontSpec *);
|
|
||||||
void uiDrawFreeFont(uiDrawFont *);
|
|
||||||
|
|
||||||
void uiDrawText(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t);
|
|
||||||
void uiDrawTextBlock(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t, uiDrawTextBlockParams *);
|
|
||||||
void uiDrawTextExtents(uiDrawContext *, const char *, uiDrawFont *, intmax_t *, intmax_t *);
|
|
||||||
intmax_t uiDrawTextExtentsBlockHeight(uiDrawContext *, const char *, uiDrawFont *, uiDrawTextBlockParams *);
|
|
||||||
// TODO width for number of lines
|
|
||||||
//TODOvoid uiDrawContextFontMetrics(uiDrawContext *, uiDrawFont *, uiDrawFontMetrics *);
|
|
||||||
|
|
||||||
// TODO draw text, single line, control font
|
|
||||||
// TODO draw text, wrapped to width, control font
|
|
||||||
// TODO get text extents, single line, control font
|
|
||||||
// TODO get text height for width, control font
|
|
||||||
// TODO width for number of lines, control font
|
|
||||||
// TODO get font metrics, control font
|
|
||||||
|
|
||||||
typedef enum uiModifiers uiModifiers;
|
typedef enum uiModifiers uiModifiers;
|
||||||
|
|
||||||
enum uiModifiers {
|
enum uiModifiers {
|
||||||
|
|
69
winarea/ui.h
69
winarea/ui.h
|
@ -76,7 +76,6 @@ struct uiDrawStrokeParams {
|
||||||
void uiDrawBeginPathRGB(uiDrawContext *, uint8_t, uint8_t, uint8_t);
|
void uiDrawBeginPathRGB(uiDrawContext *, uint8_t, uint8_t, uint8_t);
|
||||||
// TODO verify these aren't alpha premultiplied anywhere
|
// TODO verify these aren't alpha premultiplied anywhere
|
||||||
void uiDrawBeginPathRGBA(uiDrawContext *, uint8_t, uint8_t, uint8_t, uint8_t);
|
void uiDrawBeginPathRGBA(uiDrawContext *, uint8_t, uint8_t, uint8_t, uint8_t);
|
||||||
// TODO uiDrawBeginTextRGB(/RGBA?)
|
|
||||||
|
|
||||||
void uiDrawMoveTo(uiDrawContext *, intmax_t, intmax_t);
|
void uiDrawMoveTo(uiDrawContext *, intmax_t, intmax_t);
|
||||||
void uiDrawLineTo(uiDrawContext *, intmax_t, intmax_t);
|
void uiDrawLineTo(uiDrawContext *, intmax_t, intmax_t);
|
||||||
|
@ -95,74 +94,6 @@ void uiDrawFill(uiDrawContext *, uiDrawFillMode);
|
||||||
// - elliptical arcs
|
// - elliptical arcs
|
||||||
// - quadratic bezier curves
|
// - quadratic bezier curves
|
||||||
|
|
||||||
typedef struct uiDrawFont uiDrawFont;
|
|
||||||
typedef struct uiDrawFontSpec uiDrawFontSpec;
|
|
||||||
typedef struct uiDrawTextBlockParams uiDrawTextBlockParams;
|
|
||||||
typedef struct uiDrawFontMetrics uiDrawFontMetrics;
|
|
||||||
typedef enum uiDrawTextWeight uiDrawTextWeight;
|
|
||||||
typedef enum uiDrawTextAlign uiDrawTextAlign;
|
|
||||||
|
|
||||||
enum uiDrawTextWeight {
|
|
||||||
uiDrawTextWeightThin,
|
|
||||||
uiDrawTextWeightExtraLight,
|
|
||||||
uiDrawTextWeightLight,
|
|
||||||
uiDrawTextWeightNormal,
|
|
||||||
uiDrawTextWeightMedium,
|
|
||||||
uiDrawTextWeightSemiBold,
|
|
||||||
uiDrawTextWeightBold,
|
|
||||||
uiDrawTextWeightExtraBold,
|
|
||||||
uiDrawTextWeightHeavy,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawFontSpec {
|
|
||||||
const char *Family;
|
|
||||||
uintmax_t PointSize;
|
|
||||||
uiDrawTextWeight Weight;
|
|
||||||
int Italic; // always prefers true italics over obliques whenever possible
|
|
||||||
int Vertical;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum uiDrawTextAlign {
|
|
||||||
uiDrawTextAlignLeft,
|
|
||||||
uiDrawTextAlignCenter,
|
|
||||||
uiDrawTextAlignRight,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawTextBlockParams {
|
|
||||||
intmax_t Width;
|
|
||||||
intmax_t FirstLineIndent;
|
|
||||||
intmax_t LineSpacing;
|
|
||||||
uiDrawTextAlign Align;
|
|
||||||
int Justify;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uiDrawFontMetrics {
|
|
||||||
// TODO
|
|
||||||
// metrics on Windows are per-device; other platforms not?
|
|
||||||
};
|
|
||||||
|
|
||||||
#define uiDrawTextPixelSizeToPointSize(pix, dpiY) \
|
|
||||||
((uintmax_t) ((((double) (pix)) * 72.0) / ((double) (dpiY))))
|
|
||||||
#define uiDrawTextPointSizeToPixelSize(pt, dpiY) \
|
|
||||||
((uintmax_t) (((double) (pt)) * (((double) (dpiY)) / 72.0)))
|
|
||||||
|
|
||||||
uiDrawFont *uiDrawPrepareFont(uiDrawFontSpec *);
|
|
||||||
void uiDrawFreeFont(uiDrawFont *);
|
|
||||||
|
|
||||||
void uiDrawText(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t);
|
|
||||||
void uiDrawTextBlock(uiDrawContext *, const char *, uiDrawFont *, intmax_t, intmax_t, uiDrawTextBlockParams *);
|
|
||||||
void uiDrawTextExtents(uiDrawContext *, const char *, uiDrawFont *, intmax_t *, intmax_t *);
|
|
||||||
intmax_t uiDrawTextExtentsBlockHeight(uiDrawContext *, const char *, uiDrawFont *, uiDrawTextBlockParams *);
|
|
||||||
// TODO width for number of lines
|
|
||||||
//TODOvoid uiDrawContextFontMetrics(uiDrawContext *, uiDrawFont *, uiDrawFontMetrics *);
|
|
||||||
|
|
||||||
// TODO draw text, single line, control font
|
|
||||||
// TODO draw text, wrapped to width, control font
|
|
||||||
// TODO get text extents, single line, control font
|
|
||||||
// TODO get text height for width, control font
|
|
||||||
// TODO width for number of lines, control font
|
|
||||||
// TODO get font metrics, control font
|
|
||||||
|
|
||||||
typedef enum uiModifiers uiModifiers;
|
typedef enum uiModifiers uiModifiers;
|
||||||
|
|
||||||
enum uiModifiers {
|
enum uiModifiers {
|
||||||
|
|
Loading…
Reference in New Issue