diff options
author | Owen Taylor <otaylor@redhat.com> | 2005-07-21 13:55:19 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2005-07-21 13:55:19 +0000 |
commit | 6f1def024e5c0c0f75c992c26dded3c192aa455c (patch) | |
tree | 2ef6a8974d23d58dff51473c9691ab5785bdc4c6 /pango/pangocairo-win32font.c | |
parent | 07085142899378e7b5c0ad8e3fdd35ea2a941b1a (diff) | |
download | pango-6f1def024e5c0c0f75c992c26dded3c192aa455c.tar.gz |
Rework handling of context-specific options: drop get_render_key() and add
2005-07-19 Owen Taylor <otaylor@redhat.com>
* pango/pango-fcfontmap.[ch]: Rework handling of context-specific
options: drop get_render_key() and add a opaque "context
key" (get_context_key() and friends). Also add a function to get
the resolution.
* pango/pango-fcfontmap.c pango/pangofc-font.h:
- Move the 'lang' into the fontset key lookup and get rid of the
funky list-of-hash-tables
- Make lookups of fontsets and fonts dependent on the context key
for the context.
- Simplify the pattern/fontset caching to have one finite-size
cache rather than an infinite first-level and a finite-size
second level.
* pango/pangocairo.h pango/pangocairo-private.h
pango/pangocairo-fontmap.c: Add
pango_cairo_context_get/set_resolution(),
pango_cairo_context_set/get_font_options to allow controlling the
resolution and font rendering options for a specific PangoContext.
* pango/pangocairo-fcfont.c pango/pangocairo-fcfontmap
pango/pangocairo-win32font.c: Implement resolution and font
options handling adapt to related Cairo changes.
* docs/pango-sections.txt docs/Makefile.am pango/pangowin32.c:
Doc updates and build fixes.
* pango/pangofc-fontmap.c (pango_fc_make_pattern): Create
patterns with FC_SIZE as well as FC_PIXEL_SIZE to work around
a libgnomeprint bug. (#309477)
Diffstat (limited to 'pango/pangocairo-win32font.c')
-rw-r--r-- | pango/pangocairo-win32font.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/pango/pangocairo-win32font.c b/pango/pangocairo-win32font.c index 93e0e0a3..8493d8f8 100644 --- a/pango/pangocairo-win32font.c +++ b/pango/pangocairo-win32font.c @@ -51,7 +51,8 @@ struct _PangoCairoWin32Font cairo_matrix_t font_matrix; cairo_matrix_t ctm; - + cairo_font_options_t *options; + PangoFontMetrics *metrics; }; @@ -111,7 +112,8 @@ pango_cairo_win32_font_get_scaled_font (PangoCairoFont *font) font_face = pango_cairo_win32_font_get_font_face (font); cffont->scaled_font = cairo_scaled_font_create (font_face, &cffont->font_matrix, - &cffont->ctm); + &cffont->ctm, + cffont->options); /* Failure of the above should only occur for out of memory, * we can't proceed at that point @@ -158,6 +160,9 @@ pango_cairo_win32_font_finalize (GObject *object) if (cwfont->scaled_font) cairo_scaled_font_destroy (cwfont->scaled_font); + if (cwfont->options) + cairo_font_options_destroy (cwfont->options); + G_OBJECT_CLASS (pango_cairo_win32_font_parent_class)->finalize (object); } @@ -296,6 +301,7 @@ _pango_cairo_win32_font_new (PangoCairoWin32FontMap *cwfontmap, PangoWin32Font *win32font; const PangoMatrix *pango_ctm; double size; + double dpi; cwfont = g_object_new (PANGO_TYPE_CAIRO_WIN32_FONT, NULL); win32font = PANGO_WIN32_FONT (cwfont); @@ -306,11 +312,21 @@ _pango_cairo_win32_font_new (PangoCairoWin32FontMap *cwfontmap, win32font->win32face = face; size = (double) pango_font_description_get_size (desc) / PANGO_SCALE; + + if (context) + { + dpi = pango_cairo_context_get_resolution (context); + + if (dpi <= 0) + dpi = cwfontmap->dpi; + } + else + dpi = cwfontmap->dpi; if (!pango_font_description_get_size_is_absolute (desc)) - size *= cwfontmap->dpi / 72.; + size *= dpi / 72.; - /* FIXME: THis is a pixel size, so not really what we want for describe(), + /* FIXME: This is a pixel size, so not really what we want for describe(), * but it's what we need when computing the scale factor. */ win32font->size = size * PANGO_SCALE; @@ -334,5 +350,7 @@ _pango_cairo_win32_font_new (PangoCairoWin32FontMap *cwfontmap, win32font->size, &win32font->logfont); + cffont->options = cairo_font_options_copy (_pango_cairo_context_get_merged_font_options (context)); + return PANGO_FONT (cwfont); } |