2 * pangofc-private.h: Private routines and declarations for generic
5 * Copyright (C) 2003 Red Hat Software
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __PANGOFC_PRIVATE_H__
24 #define __PANGOFC_PRIVATE_H__
26 #include <pangofc-fontmap.h>
31 typedef struct _PangoFcMetricsInfo PangoFcMetricsInfo;
33 struct _PangoFcMetricsInfo
35 const char *sample_str;
36 PangoFontMetrics *metrics;
40 typedef struct _PangoFcCmapCacheEntry PangoFcCmapCacheEntry;
41 typedef struct _PangoFcCmapCache PangoFcCmapCache;
43 #define CMAP_CACHE_NUM_ENTRIES 256 /* should be power of two */
44 #define CMAP_CACHE_MASK (CMAP_CACHE_NUM_ENTRIES - 1)
46 struct _PangoFcCmapCacheEntry
52 struct _PangoFcCmapCache
55 PangoFcCmapCacheEntry entries[CMAP_CACHE_NUM_ENTRIES];
59 #define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6))
60 #define PANGO_PIXELS_26_6(d) \
62 ((d) + PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6 : \
63 ((d) - PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6)
64 #define PANGO_UNITS_26_6(d) (PANGO_SCALE_26_6 * (d))
66 void _pango_fc_font_shutdown (PangoFcFont *fcfont);
68 void _pango_fc_font_map_remove (PangoFcFontMap *fcfontmap,
71 PangoCoverage *_pango_fc_font_map_get_coverage (PangoFcFontMap *fcfontmap,
73 PangoCoverage *_pango_fc_font_map_fc_to_coverage (FcCharSet *charset);
75 PangoFcCmapCache *_pango_fc_font_map_get_cmap_cache (PangoFcFontMap *fcfontmap,
77 void _pango_fc_cmap_cache_unref (PangoFcCmapCache *cmap_cache);
79 PangoFcDecoder *_pango_fc_font_get_decoder (PangoFcFont *font);
80 void _pango_fc_font_set_decoder (PangoFcFont *font,
81 PangoFcDecoder *decoder);
83 PangoFcFontKey *_pango_fc_font_get_font_key (PangoFcFont *fcfont);
84 void _pango_fc_font_set_font_key (PangoFcFont *fcfont,
87 void pango_fc_font_get_raw_extents (PangoFcFont *font,
90 PangoRectangle *ink_rect,
91 PangoRectangle *logical_rect);
93 PangoFontMetrics *pango_fc_font_create_metrics_for_context (PangoFcFont *font,
94 PangoContext *context);
98 /* To be made public at some point */
102 static G_GNUC_UNUSED void
103 pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
104 double *xscale, double *yscale)
107 * Based on cairo-matrix.c:_cairo_matrix_compute_scale_factors()
109 * Copyright 2005, Keith Packard
111 double major = 0, minor = 0;
114 double det = matrix->xx * matrix->yy - matrix->yx * matrix->xy;
118 double x = matrix->xx;
119 double y = matrix->yx;
121 major = sqrt (x*x + y*y);
142 #endif /* __PANGOFC_PRIVATE_H__ */