cairo/doc/reference/xml/cairo_text_extents_t.xml
Owen Taylor 97424a3c2a Change cairo_font_t to refer to a font scaled to a particular output device resolution.
src/cairoint.h src/cairo_font.c src/cairo_ft_font.c src/cairo_xlib_surface.c src/cairo_pdf_surface.c src/cairo_gstate.c src/cairo.c: Switch many internal methods from handling cairo_unscaled_font_t and cairo_font_scale_t pairs to handling cairo_font_t.
src/cairo-ft-private.h src/cairo_ft_fontc: Add some internal interfaces for use by the FreeType backend.
Clear the gstate's current font when the transform or target surface changes.
src/cairo.h src/cairo_ft_font.c: Rename cairo_ft_font_pattern to cairo_ft_font_get_pattern().
src/cairo.h src/cairo_ft_font.c: Make cairo_ft_font_create() and cairo_ft_font_create_for_ft_face() take a font scale; make the latter take load_flags for FT_Load_Glyph() as well. Change cairo_ft_font_face() to Xft-style cairo_ft_font_lock_face, cairo_ft_font_unlock_face.
Remove the name/slant/weight=>unscaled font cache, it didn't work with the new cairo_font_t setup. If it turns out to be needed, it can be added back in some other form.
src/cairoint.h src/cairo_font.c: Add a 'flags' field to cairo_glyph_cache_key_t, we use it for load flags with freetype backend.
Switch the caching to be from resolved fontconfig pattern => file; keep only a fixed number of FT_Face objects open at once, similar to FreeType.
src/cairo_gstate.c src/cairoint.h: Add public cairo_font_glyph_extents, use it to implement _cairo_gstate_glyph_extents().
Add refcounting for glyph cache elements; there was an bug where elements got ejected from the cache and freed before they could be used.
src/cairoint.h src/cairo_cache.c (_cairo_cache_random_entry()) New function to return a random entry in the cache matching a predicate; reuse the internals for the previous _random_live_entry().
src/cairoint.h src/cairo_cache.c (_cairo_cache_lookup()): Add an optional created_entry return value.
src/cairo_ft_font.c src/cairo_xlib_surface.c: Adapt to _cairo_cache_lookup() change.
Support max_memory == 0 to indicate an unbounded cache.
src/cairoint.h src/cairo_cache.c (_cairo_cache_remove()): Add a function to manually remove entries from the cache.
Update for changes, document cairo_matrix_t, cairo_glyph_t, etc.
src/cairo.h src/cairo-atsui.h src/cairo-ft.h src/cairo-glitz.h src/cairo-pdf.h src/cairo-png.h src/cairo-ps.h src/cairo-quartz.h src/cairo-xcb.h src/cairo-xlib.h: Add CAIRO_BEGIN/END_DECLS for extern "C", use it on all public headers. Move header guards outermost.
Fix encoding.
2005-01-21 14:33:47 +00:00

76 lines
2.8 KiB
XML

<refentry id="cairo_text_extents_t">
<refmeta>
<refentrytitle>cairo_text_extents_t</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>cairo_text_extents_t</refname>
<refpurpose>struct to store extents of a string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para><indexterm><primary>types</primary><secondary>cairo_text_extents_t</secondary></indexterm><indexterm><primary/></indexterm>
<programlisting>
typedef struct {
double x_bearing;
double y_bearing;
double width;
double height;
double x_advance;
double y_advance;
} cairo_text_extents_t;
</programlisting>
</para>
<para>
The <structname>cairo_text_extents_t</structname> structure
stores the extents of a single glyph or a string of glyphs in
user-space coordinates. Because text extents are in user-space
coordinates, they don't scale along with the current
transformation matrix. If you call <link linkend="cairo_scale">cairo_scale</link>(cr, 2.0, 2.0),
text will be drawn twice as big, but the reported text extents
will not be doubled. They will change slightly due to hinting
(so you can't assume that metrics are independent of the
transformation matrix), but otherwise will remain unchanged.
</para>
<variablelist role="struct">
<varlistentry>
<term><structfield>x_bearing</structfield></term>
<listitem><simpara>the horizontal distance from the origin to the
leftmost part of the glyphs as drawn. Positive if the
glyphs lie entirely to the right of the origin.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>y_bearing</structfield></term>
<listitem><simpara>the vertical distance from the origin to the
topmost part of the glyphs as drawn. Positive only if the
glyphs lie completely below the origin; will usually be negative.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>width</structfield></term>
<listitem><simpara>width of the glyphs as drawn.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>height</structfield></term>
<listitem><simpara>height of the glyphs as drawn.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>x_advance</structfield></term>
<listitem><simpara>distance to advance in the X direction
after drawing these glyphs.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><structfield>y_advance</structfield></term>
<listitem><simpara>distance to advance in the Y direction
after drawing these glyphs. Will typically be zero except
for vertical text layout as found in East-Asian languages.
</simpara></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>