mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-07 12:30:30 +01:00
[ATSUI] scale fonts using font size not font matrix
Mozilla bug #327522 - fonts scaled up over 16pt on mac had nonsensical extents. The scaling was being done using the font matrix, it turns out this does not work for 16x scaling and up. This patch switches back to using the font size to scale fonts, with emboldening and condensing effects applied separately using the font matrix.
This commit is contained in:
parent
eec62c2975
commit
9dce321a11
1 changed files with 9 additions and 13 deletions
|
|
@ -195,26 +195,22 @@ CGAffineTransformMakeWithCairoFontScale(const cairo_matrix_t *scale)
|
|||
0, 0);
|
||||
}
|
||||
|
||||
static CGAffineTransform
|
||||
CGAffineTransformMakeWithCairoScaleFactors(const cairo_matrix_t *scale)
|
||||
{
|
||||
double xscale = 1.0;
|
||||
double yscale = 1.0;
|
||||
_cairo_matrix_compute_scale_factors(scale, &xscale, &yscale, 1);
|
||||
return CGAffineTransformMake(xscale, 0,
|
||||
0, yscale,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
static ATSUStyle
|
||||
CreateSizedCopyOfStyle(ATSUStyle inStyle, const cairo_matrix_t *scale)
|
||||
{
|
||||
ATSUStyle style;
|
||||
OSStatus err;
|
||||
double xscale = 1.0;
|
||||
double yscale = 1.0;
|
||||
CGAffineTransform theTransform;
|
||||
|
||||
_cairo_matrix_compute_scale_factors(scale, &xscale, &yscale, 1);
|
||||
theTransform = CGAffineTransformMake(1.0, 0,
|
||||
0, yscale/xscale,
|
||||
0, 0);
|
||||
|
||||
/* Set the style's size */
|
||||
Fixed theSize = FloatToFixed(1.0);
|
||||
CGAffineTransform theTransform = CGAffineTransformMakeWithCairoScaleFactors(scale);
|
||||
Fixed theSize = FloatToFixed(xscale);
|
||||
const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag, kATSUFontMatrixTag };
|
||||
const ByteCount theFontStyleSizes[] = { sizeof(Fixed), sizeof(CGAffineTransform) };
|
||||
ATSUAttributeValuePtr theFontStyleValues[] = { &theSize, &theTransform };
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue