aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-font.h
blob: 74c91aace56c26131f6257aaddd1ca8220d2a5b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _E_FONT_H_
#define _E_FONT_H_

/*
 * e-font
 *
 * Temporary wrappers around GdkFonts to get unicode displaying
 *
 * Author: Lauris Kaplinski <lauris@helixcode.com>
 *
 * Copyright (C) 2000 Helix Code, Inc.
 *
 */

#include <glib.h>
#include <gdk/gdk.h>
#include <libgnome/gnome-defs.h>

BEGIN_GNOME_DECLS

typedef struct _EFont EFont;

/*
 * We use very primitive styling here, enough for marking read/unread lines
 */

typedef enum {
    E_FONT_PLAIN = 0,
    E_FONT_BOLD = (1 << 0),
    E_FONT_ITALIC = (1 << 4)
} EFontStyle;

EFont * e_font_from_gdk_name (const gchar *name);
EFont * e_font_from_gdk_font (GdkFont *font);

void e_font_ref (EFont *font);
void e_font_unref (EFont *font);

gint e_font_ascent (EFont * font);
gint e_font_descent (EFont * font);

/*
 * NB! UTF-8 text widths are given in chars, not bytes
 */

void e_font_draw_utf8_text (GdkDrawable *drawable, EFont *font, EFontStyle style, GdkGC *gc, gint x, gint y, gchar *text, gint numchars);
int e_font_utf8_text_width (EFont *font, EFontStyle style, char *text, int numchars);

#if 0
void e_font_draw_ucs2_text (GdkDrawable *drawable, EFont *font, GdkGC *gc, gint x, gint y, short *text, gint length);

gboolean e_ucs2_isspace (short ch);

unsigned short *e_ucs2_from_utf8 (const gchar *text);
unsigned short *e_ucs2_from_utf8_sized (const gchar *text, gint length);

unsigned char *e_utf8_from_ucs2_sized (const short *text, int length);

int e_font_ucs2_text_width (EFont *font, short *text, int length);

int e_ucs2_strlen (const short *text);

short * e_ucs2_strncpy (short *dst, short *src, int length);
short * e_ucs2_strcpy (short *dst, short *src);

short * e_ucs2_strdup (const short *string);

gint e_ucs2_strcmp (const short *a, const short *b);
#endif

END_GNOME_DECLS

#endif