54 lines
2.0 KiB
Plaintext
54 lines
2.0 KiB
Plaintext
$OpenBSD: patch-gfx_src_gtk_nsFontMetricsXft_cpp,v 1.2 2006/12/04 09:47:54 jolan Exp $
|
|
--- gfx/src/gtk/nsFontMetricsXft.cpp.orig Fri Jun 30 02:18:34 2006
|
|
+++ gfx/src/gtk/nsFontMetricsXft.cpp Thu Nov 23 19:03:59 2006
|
|
@@ -881,8 +881,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);
|
|
}
|
|
@@ -892,8 +898,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)));
|
|
}
|
|
@@ -905,7 +917,7 @@ nsFontMetricsXft::CacheFontMetrics(void)
|
|
TT_OS2 *os2 = (TT_OS2 *) FT_Get_Sfnt_Table(face, ft_sfnt_os2);
|
|
|
|
// 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)));
|
|
@@ -915,7 +927,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.
|