File: htmlfontspecification.h

package info (click to toggle)
claws-mail-extra-plugins 3.5.0-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 35,040 kB
  • ctags: 10,917
  • sloc: ansic: 86,223; sh: 15,775; makefile: 4,400; perl: 983; yacc: 219; lex: 168
file content (114 lines) | stat: -rw-r--r-- 3,823 bytes parent folder | download | duplicates (6)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
   Copyright (C) 2000 CodeFactory AB
   Copyright (C) 2000 Jonas Borgstrm <jonas@codefactory.se>
   Copyright (C) 2000 Anders Carlsson <andersca@codefactory.se>
   Copyright (C) 2000 Red Hat Software
   
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
   
   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/
#ifndef __HTMLFONTDESCRIPTION_H__
#define __HTMLFONTDESCRIPTION_H__

#include <pango/pango-font.h>
#include <pango/pango-attributes.h>
#include <gtk/gtk.h>

typedef struct _HtmlFontSpecification HtmlFontSpecification;

typedef enum {
	HTML_FONT_STYLE_NORMAL = 0,
	HTML_FONT_STYLE_ITALIC,
	HTML_FONT_STYLE_OBLIQUE
} HtmlFontStyleType;

typedef enum {
	HTML_FONT_VARIANT_NORMAL = 0,
	HTML_FONT_VARIANT_SMALL_CAPS
} HtmlFontVariantType;

#define HTML_FONT_WEIGHT_NORMAL HTML_FONT_WEIGHT_400
#define HTML_FONT_WEIGHT_BOLD HTML_FONT_WEIGHT_700

typedef enum {
	HTML_FONT_WEIGHT_100,
	HTML_FONT_WEIGHT_200,
	HTML_FONT_WEIGHT_300,
	HTML_FONT_WEIGHT_400,
	HTML_FONT_WEIGHT_500,
	HTML_FONT_WEIGHT_600,
	HTML_FONT_WEIGHT_700,
	HTML_FONT_WEIGHT_800,
	HTML_FONT_WEIGHT_900
} HtmlFontWeightType;

typedef enum {
	HTML_FONT_STRETCH_NORMAL = 0,
	HTML_FONT_STRETCH_ULTRA_CONDENSED,
	HTML_FONT_STRETCH_EXTRA_CONDENSED,
	HTML_FONT_STRETCH_CONDENSED,
	HTML_FONT_STRETCH_SEMI_CONDENSED,
	HTML_FONT_STRETCH_SEMI_EXPANDED,
	HTML_FONT_STRETCH_EXPANDED,
	HTML_FONT_STRETCH_EXTRA_EXPANDED,
	HTML_FONT_STRETCH_ULTRA_EXPANDED
} HtmlFontStretchType;

typedef enum {
	HTML_FONT_DECORATION_NONE = 0, 
	HTML_FONT_DECORATION_UNDERLINE = 1 << 0,
	HTML_FONT_DECORATION_OVERLINE = 1 << 1,
	HTML_FONT_DECORATION_LINETHROUGH = 1 << 2
} HtmlFontDecorationType;

struct _HtmlFontSpecification {
	gchar *family; /* Comma separated list of family names */
	gfloat size;
	guint weight : 4;
	guint style : 2;
	guint variant : 2;
	guint stretch : 4;
	guint decoration : 3;
};

HtmlFontSpecification *html_font_specification_new (gchar *family,
						    HtmlFontStyleType style, 
						    HtmlFontVariantType variant,
						    HtmlFontWeightType weight,
						    HtmlFontStretchType stretch, 
						    HtmlFontDecorationType decoration,
						    gfloat size);

HtmlFontSpecification * html_font_specification_ref (HtmlFontSpecification *spec);
void html_font_specification_unref (HtmlFontSpecification *spec);

HtmlFontSpecification * html_font_specification_dup (HtmlFontSpecification *spec);

gboolean html_font_description_equal (HtmlFontSpecification *a, HtmlFontSpecification *b);

PangoFontDescription *html_font_specification_get_pango_font_description (HtmlFontSpecification *spec);

void html_font_specification_get_extra_attributes (HtmlFontSpecification *spec,
						   PangoAttrList *attrs,
						   gint start_index, gint end_index);
void html_font_specification_get_all_attributes (HtmlFontSpecification *spec,
						 PangoAttrList *attrs,
						 gint start_index, gint end_index,
						 gdouble magnification);
gint html_font_specification_get_html_size (HtmlFontSpecification *spec);
gfloat html_font_description_html_size_to_pt (gint font_size);

#endif /* __HTMLFONTSPECIFICATION_H__ */