~ubuntu-branches/ubuntu/oneiric/inkscape/oneiric-updates

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/libcroco/cr-fonts.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
 
2
 
 
3
/*
 
4
 * This file is part of The Croco Library
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of version 2.1 of 
 
8
 * the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the 
 
17
 * GNU Lesser General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
20
 * USA
 
21
 *
 
22
 * Author: Dodji Seketeli
 
23
 * See COPYRIGHTS file for copyright information.
 
24
 */
 
25
 
 
26
#ifndef __CR_FONTS_H__
 
27
#define __CR_FONTS_H__
 
28
#endif
 
29
 
 
30
#include "cr-utils.h"
 
31
#include "cr-num.h"
 
32
 
 
33
/**
 
34
 *@file
 
35
 *Various type declarations about font selection related
 
36
 *properties.
 
37
 */
 
38
G_BEGIN_DECLS
 
39
 
 
40
 
 
41
enum CRFontFamilyType
 
42
{
 
43
        FONT_FAMILY_SANS_SERIF,
 
44
        FONT_FAMILY_SERIF,      
 
45
        FONT_FAMILY_CURSIVE,
 
46
        FONT_FAMILY_FANTASY,
 
47
        FONT_FAMILY_MONOSPACE,
 
48
        FONT_FAMILY_NON_GENERIC,
 
49
        FONT_FAMILY_INHERIT,
 
50
        /**/
 
51
        NB_FONT_FAMILIE_TYPES
 
52
} ;
 
53
 
 
54
typedef struct _CRFontFamily CRFontFamily ;
 
55
 
 
56
struct _CRFontFamily
 
57
{
 
58
        enum CRFontFamilyType type ;
 
59
 
 
60
        /*
 
61
         *The name of the font family, in case
 
62
         *it is non generic.
 
63
         *Is set only if the type is FONT_FAMILY_NON_GENERIC.
 
64
         */
 
65
        guchar *name ;
 
66
 
 
67
        CRFontFamily *next ;
 
68
        CRFontFamily *prev ;
 
69
} ;
 
70
 
 
71
 
 
72
/**
 
73
 *The different types
 
74
 *of absolute font size.
 
75
 *This is used by the 'font-size'
 
76
 *property defined in css2 spec
 
77
 *in chapter 15.2.4 .
 
78
 *These values a indexes of 
 
79
 *table of size so please, do not
 
80
 *change their definition order unless
 
81
 *you know what you are doing.
 
82
 */
 
83
enum CRPredefinedAbsoluteFontSize
 
84
{
 
85
        FONT_SIZE_XX_SMALL=0,
 
86
        FONT_SIZE_X_SMALL,
 
87
        FONT_SIZE_SMALL,
 
88
        FONT_SIZE_MEDIUM,
 
89
        FONT_SIZE_LARGE,
 
90
        FONT_SIZE_X_LARGE,
 
91
        FONT_SIZE_XX_LARGE,
 
92
        FONT_SIZE_INHERIT,
 
93
        NB_PREDEFINED_ABSOLUTE_FONT_SIZES
 
94
} ;
 
95
 
 
96
/**
 
97
 *The different types
 
98
 *of relative font size.
 
99
 *This is used by the 'font-size'
 
100
 *property defined in css2 spec
 
101
 *in chapter 15.2.4 .
 
102
 *These values a indexes of 
 
103
 *table of size so please, do not
 
104
 *change their definition order unless
 
105
 *you know what you are doing.
 
106
 */
 
107
enum CRRelativeFontSize
 
108
{        
 
109
        FONT_SIZE_LARGER,
 
110
        FONT_SIZE_SMALLER,
 
111
        NB_RELATIVE_FONT_SIZE
 
112
} ;
 
113
 
 
114
/**
 
115
 *The type of font-size property.
 
116
 *Used to define the type of #CRFontSize .
 
117
 *See css2 spec chapter 15.2.4 to understand.
 
118
 */
 
119
enum CRFontSizeType {
 
120
        /**
 
121
         *If the type of #CRFontSize is
 
122
         *PREDEFINED_ABSOLUTE_FONT_SIZE,
 
123
         *the CRFontSize::value.predefined_absolute 
 
124
         *field will be defined.
 
125
         */
 
126
        PREDEFINED_ABSOLUTE_FONT_SIZE,
 
127
        
 
128
        /**
 
129
         *If the type of #CRFontSize is
 
130
         *ABSOLUTE_FONT_SIZE,
 
131
         *the CRFontSize::value.absolute 
 
132
         *field will be defined.
 
133
         */
 
134
        ABSOLUTE_FONT_SIZE,
 
135
 
 
136
        /**
 
137
         *If the type of #CRFontSize is
 
138
         *RELATIVE_FONT_SIZE,
 
139
         *the CRFontSize::value.relative
 
140
         *field will be defined.
 
141
         */
 
142
        RELATIVE_FONT_SIZE,
 
143
 
 
144
        /**
 
145
         *If the type of #CRFontSize is
 
146
         *INHERITED_FONT_SIZE,
 
147
         *the None of the field of the CRFontSize::value enum
 
148
         *will be defined.
 
149
         */
 
150
        INHERITED_FONT_SIZE,
 
151
 
 
152
        NB_FONT_SIZE_TYPE
 
153
} ;
 
154
 
 
155
typedef struct _CRFontSize CRFontSize ;
 
156
struct _CRFontSize {
 
157
        enum CRFontSizeType type ;
 
158
        union  {
 
159
                enum CRPredefinedAbsoluteFontSize predefined ;
 
160
                enum CRRelativeFontSize relative ;
 
161
                CRNum absolute ;
 
162
        } value;
 
163
} ;
 
164
 
 
165
enum CRFontSizeAdjustType
 
166
{
 
167
        FONT_SIZE_ADJUST_NONE = 0,
 
168
        FONT_SIZE_ADJUST_NUMBER,
 
169
        FONT_SIZE_ADJUST_INHERIT
 
170
} ;
 
171
typedef struct _CRFontSizeAdjust CRFontSizeAdjust ;
 
172
struct _CRFontSizeAdjust
 
173
{
 
174
        enum CRFontSizeAdjustType type ;
 
175
        CRNum *num ;
 
176
} ;
 
177
 
 
178
enum CRFontStyle
 
179
{
 
180
        FONT_STYLE_NORMAL=0,
 
181
        FONT_STYLE_ITALIC,
 
182
        FONT_STYLE_OBLIQUE,
 
183
        FONT_STYLE_INHERIT
 
184
} ;
 
185
 
 
186
enum CRFontVariant
 
187
{
 
188
        FONT_VARIANT_NORMAL=0,
 
189
        FONT_VARIANT_SMALL_CAPS,
 
190
        FONT_VARIANT_INHERIT
 
191
} ;
 
192
 
 
193
enum CRFontWeight
 
194
{
 
195
        FONT_WEIGHT_NORMAL = 1,
 
196
        FONT_WEIGHT_BOLD = 1<<1,
 
197
        FONT_WEIGHT_BOLDER = 1<<2,
 
198
        FONT_WEIGHT_LIGHTER = 1<<3,
 
199
        FONT_WEIGHT_100 = 1<<4,
 
200
        FONT_WEIGHT_200 = 1<<5,
 
201
        FONT_WEIGHT_300 = 1<<6,
 
202
        FONT_WEIGHT_400 = 1<<7,
 
203
        FONT_WEIGHT_500 = 1<<8,
 
204
        FONT_WEIGHT_600 = 1<<9,
 
205
        FONT_WEIGHT_700 = 1<<10,
 
206
        FONT_WEIGHT_800 = 1<<11,
 
207
        FONT_WEIGHT_900 = 1<<12,
 
208
        FONT_WEIGHT_INHERIT = 1<<13,
 
209
        NB_FONT_WEIGHTS
 
210
} ;
 
211
 
 
212
enum CRFontStretch
 
213
{
 
214
        FONT_STRETCH_NORMAL=0,
 
215
        FONT_STRETCH_WIDER,
 
216
        FONT_STRETCH_NARROWER,
 
217
        FONT_STRETCH_ULTRA_CONDENSED,
 
218
        FONT_STRETCH_EXTRA_CONDENSED,
 
219
        FONT_STRETCH_CONDENSED,
 
220
        FONT_STRETCH_SEMI_CONDENSED,
 
221
        FONT_STRETCH_SEMI_EXPANDED,
 
222
        FONT_STRETCH_EXPANDED,
 
223
        FONT_STRETCH_EXTRA_EXPANDED,
 
224
        FONT_STRETCH_ULTRA_EXPANDED,
 
225
        FONT_STRETCH_INHERIT
 
226
} ;
 
227
 
 
228
/**************************************
 
229
 *'font-family' manipulation functions
 
230
 ***************************************/
 
231
CRFontFamily *
 
232
cr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name) ;
 
233
 
 
234
CRFontFamily *
 
235
cr_font_family_append (CRFontFamily *a_this, 
 
236
                       CRFontFamily *a_family_to_append) ;
 
237
 
 
238
guchar *
 
239
cr_font_family_to_string (CRFontFamily *a_this,
 
240
                          gboolean a_walk_font_family_list) ;
 
241
 
 
242
CRFontFamily *
 
243
cr_font_family_prepend (CRFontFamily *a_this, 
 
244
                        CRFontFamily *a_family_to_prepend);
 
245
 
 
246
enum CRStatus
 
247
cr_font_family_destroy (CRFontFamily *a_this) ;
 
248
 
 
249
enum CRStatus
 
250
cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name) ;
 
251
 
 
252
 
 
253
/************************************
 
254
 *'font-size' manipulation functions
 
255
 ***********************************/
 
256
 
 
257
CRFontSize * cr_font_size_new (void) ;
 
258
 
 
259
enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
 
260
 
 
261
enum CRStatus cr_font_size_copy (CRFontSize *a_dst, 
 
262
                                 CRFontSize *a_src) ;
 
263
enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this, 
 
264
                                                              enum CRPredefinedAbsoluteFontSize a_predefined) ;
 
265
enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this,
 
266
                                                   enum CRRelativeFontSize a_relative) ;
 
267
 
 
268
enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this,
 
269
                                                   enum CRNumType a_num_type,
 
270
                                                   gdouble a_value) ;
 
271
 
 
272
enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
 
273
 
 
274
gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
 
275
 
 
276
gchar* cr_font_size_to_string (CRFontSize *a_this) ;
 
277
 
 
278
void cr_font_size_destroy (CRFontSize *a_font_size) ;
 
279
 
 
280
/*******************************************************
 
281
 *'font-size-adjust' manipulation function declarations
 
282
 *******************************************************/
 
283
 
 
284
CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
 
285
 
 
286
gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
 
287
 
 
288
void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
 
289
 
 
290
void 
 
291
cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
 
292
                                               enum CRPredefinedAbsoluteFontSize *a_smaller_size) ;
 
293
void
 
294
cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
 
295
                                              enum CRPredefinedAbsoluteFontSize *a_larger_size) ;
 
296
 
 
297
gboolean
 
298
cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) ;
 
299
 
 
300
/***********************************
 
301
 *various other font related functions
 
302
 ***********************************/
 
303
const gchar * cr_font_style_to_string (enum CRFontStyle a_code) ;
 
304
 
 
305
const gchar * cr_font_weight_to_string (enum CRFontWeight a_code)  ;
 
306
 
 
307
enum CRFontWeight
 
308
cr_font_weight_get_bolder (enum CRFontWeight a_weight) ;
 
309
 
 
310
const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ;
 
311
 
 
312
const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
 
313
 
 
314
G_END_DECLS