Commit 8f05a63d authored by Darin Adler's avatar Darin Adler

Fix font metrics to take affine matrix into account.

	* rsvg-ft.c: (rsvg_ft_measure_or_render_string): Fix font metrics
	to take affine matrix into account.

	* rsvg.c: (rsvg_text_handler_characters): Point to correct
	directory for eel 2.

	* test-61223.svg: Test file for another bug.
parent f7de3b00
2001-09-29 Darin Adler <darin@bentspoon.com>
* rsvg-ft.c: (rsvg_ft_measure_or_render_string): Fix font metrics
to take affine matrix into account.
* rsvg.c: (rsvg_text_handler_characters): Point to correct
directory for eel 2.
* test-61223.svg: Test file for another bug.
2001-09-25 Darin Adler <darin@bentspoon.com>
* test-60544.svg: Another test file, from another bug.
......
......@@ -841,17 +841,17 @@ rsvg_ft_measure_or_render_string (RsvgFTCtx *ctx,
FT_FROMFLOAT(sx),
FT_FROMFLOAT(sy),
72, 72);
pixel_height = FT_TRUNC (FT_CEIL (font->face->size->metrics.ascender
- font->face->size->metrics.descender));
pixel_baseline = FT_TRUNC (FT_CEIL (font->face->size->metrics.ascender));
pixel_height = FT_TOFLOAT (font->face->size->metrics.ascender
- font->face->size->metrics.descender) * affine[3];
pixel_baseline = FT_TOFLOAT (font->face->size->metrics.ascender) * affine[3];
pixel_underline_position = ((font->face->ascender
- font->face->underline_position
- font->face->underline_thickness / 2) * sy
/ font->face->units_per_EM);
/ font->face->units_per_EM) * affine[3];
pixel_underline_thickness = (font->face->underline_thickness * sy
/ font->face->units_per_EM);
/ font->face->units_per_EM) * affine[3];
pixel_underline_thickness = MAX (1, pixel_underline_thickness);
bbox.x0 = bbox.x1 = 0;
......@@ -982,9 +982,10 @@ rsvg_ft_measure_or_render_string (RsvgFTCtx *ctx,
/* Some callers of this function expect to get something with
* non-zero width and height. So force the returned glyph to
* be at least one pixel wide
* be at least one pixel wide and tall.
*/
pixel_width = MAX (1, bbox.x1 - bbox.x0);
pixel_height = MAX (1, pixel_height);
dimensions[0] = pixel_width;
dimensions[1] = pixel_height;
......@@ -1021,7 +1022,7 @@ rsvg_ft_measure_or_render_string (RsvgFTCtx *ctx,
rsvg_ft_glyph_composite (result, glyphs[i],
glyph_xy[i * 2] - bbox.x0,
glyph_xy[i * 2 + 1]
+ pixel_baseline - glyph_affine[5]);
+ pixel_baseline - affine[5]);
rsvg_ft_glyph_unref (glyphs[i]);
}
......
......@@ -901,7 +901,7 @@ rsvg_text_handler_characters (RsvgSaxHandler *self, const xmlChar *ch, int len)
* bug for details.
*/
if (fonts_dir == NULL) {
dir = DATADIR "/eel/fonts";
dir = DATADIR "/eel-2/eel/fonts";
} else {
dir = fonts_dir;
}
......
<?xml version="1.0" encoding="iso-8859-2" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN" "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
<svg width="400pt" height="100pt" xml:space="preserve">
<g id="textbox" style="fill:#FFFFFF; stroke:#000000;
font-family: Helvetica; font-size:40pt">
<text transform="matrix(1 0 0 1 100 70)">Hello world!</text>
</g>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment