openbsd-ports/www/mozilla/patches/patch-gfx_src_gtk_nsFontMetricsXft_cpp

54 lines
2.0 KiB
Plaintext

$OpenBSD: patch-gfx_src_gtk_nsFontMetricsXft_cpp,v 1.1 2006/03/27 04:23:28 pvalchev Exp $
--- gfx/src/gtk/nsFontMetricsXft.cpp.orig Wed Feb 16 10:08:37 2005
+++ gfx/src/gtk/nsFontMetricsXft.cpp Sun Mar 26 18:20:10 2006
@@ -869,8 +869,14 @@ nsFontMetricsXft::CacheFontMetrics(void)
mXHeight = nscoord(mXHeight * f);
// mUnderlineOffset (offset for underlines)
- val = CONVERT_DESIGN_UNITS_TO_PIXELS(face->underline_position,
+ if (face) {
+ val = CONVERT_DESIGN_UNITS_TO_PIXELS(face->underline_position,
face->size->metrics.y_scale);
+ }
+ else {
+ val = 0.0f;
+ }
+
if (val) {
mUnderlineOffset = NSToIntRound(val * f);
}
@@ -880,8 +886,14 @@ nsFontMetricsXft::CacheFontMetrics(void)
}
// mUnderlineSize (thickness of an underline)
- val = CONVERT_DESIGN_UNITS_TO_PIXELS(face->underline_thickness,
+ if (face) {
+ val = CONVERT_DESIGN_UNITS_TO_PIXELS(face->underline_thickness,
face->size->metrics.y_scale);
+ }
+ else {
+ val = 0.0f;
+ }
+
if (val) {
mUnderlineSize = nscoord(PR_MAX(f, NSToIntRound(val * f)));
}
@@ -891,7 +903,7 @@ nsFontMetricsXft::CacheFontMetrics(void)
}
// mSuperscriptOffset
- if (os2 && os2->ySuperscriptYOffset) {
+ if (face && os2 && os2->ySuperscriptYOffset) {
val = CONVERT_DESIGN_UNITS_TO_PIXELS(os2->ySuperscriptYOffset,
face->size->metrics.y_scale);
mSuperscriptOffset = nscoord(PR_MAX(f, NSToIntRound(val * f)));
@@ -901,7 +913,7 @@ nsFontMetricsXft::CacheFontMetrics(void)
}
// mSubscriptOffset
- if (os2 && os2->ySubscriptYOffset) {
+ if (face && os2 && os2->ySubscriptYOffset) {
val = CONVERT_DESIGN_UNITS_TO_PIXELS(os2->ySubscriptYOffset,
face->size->metrics.y_scale);
// some fonts have the incorrect sign.