+2006-05-25 Dave Hyatt <hyatt@apple.com>
+
+ For now eliminate the logical scale factor from Cairo.
+ This enables bitmap fonts like MS Sans Serif to work on
+ Win32.
+
+ * platform/cairo/cairo/src/cairo-win32-font.c:
+ (cairo_win32_scaled_font_select_font):
+ * platform/cairo/cairo/src/cairo-win32-private.h:
+ * platform/cairo/font-bug-patch.txt: Removed.
+ * platform/cairo/scale-removal.txt: Added.
+ * platform/win/FontCacheWin.cpp:
+ (WebCore::FontCache::createFontPlatformData):
+ * platform/win/FontDataWin.cpp:
+ (WebCore::FontData::smallCapsFontData):
+ (WebCore::FontData::platformWidthForGlyph):
+ * platform/win/FontPlatformData.h:
+ * platform/win/GlyphMapWin.cpp:
+ (WebCore::GlyphMap::fillPage):
+
2006-05-25 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by hyatt. Landed by eseidel.
return CAIRO_STATUS_NO_MEMORY;
old_hfont = SelectObject (hdc, hfont);
- // FIXME: This error is occurring and killing all subsequent text drawing.
- // Probably my fault, but comment it out until we're certain.
- //if (!old_hfont)
- // return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font:SelectObject");
+ if (!old_hfont)
+ return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font:SelectObject");
old_mode = SetGraphicsMode (hdc, GM_ADVANCED);
if (!old_mode) {
#include <cairo-win32.h>
#include <cairoint.h>
-#define WIN32_FONT_LOGICAL_SCALE 32
+#define WIN32_FONT_LOGICAL_SCALE 1
typedef struct _cairo_win32_surface {
cairo_surface_t base;
+++ /dev/null
-Index: cairo/src/cairo-win32-font.c
-===================================================================
---- cairo/src/cairo-win32-font.c (revision 14498)
-+++ cairo/src/cairo-win32-font.c (working copy)
-@@ -1503,8 +1503,10 @@
- return CAIRO_STATUS_NO_MEMORY;
-
- old_hfont = SelectObject (hdc, hfont);
-- if (!old_hfont)
-- return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font:SelectObject");
-+ // FIXME: This error is occurring and killing all subsequent text drawing.
-+ // Probably my fault, but comment it out until we're certain.
-+ //if (!old_hfont)
-+ // return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font:SelectObject");
-
- old_mode = SetGraphicsMode (hdc, GM_ADVANCED);
- if (!old_mode) {
--- /dev/null
+Index: cairo/src/cairo-win32-private.h
+===================================================================
+--- cairo/src/cairo-win32-private.h (revision 14582)
++++ cairo/src/cairo-win32-private.h (working copy)
+@@ -39,7 +39,7 @@
+ #include <cairo-win32.h>
+ #include <cairoint.h>
+
+-#define WIN32_FONT_LOGICAL_SCALE 32
++#define WIN32_FONT_LOGICAL_SCALE 1
+
+ typedef struct _cairo_win32_surface {
+ cairo_surface_t base;
LOGFONT winfont;
// The size here looks unusual. The negative number is intentional. The logical size constant is 32.
- winfont.lfHeight = WIN32_FONT_LOGICAL_SCALE * -fontDescription.computedPixelSize();
+ winfont.lfHeight = -fontDescription.computedPixelSize();
winfont.lfWidth = 0;
winfont.lfEscapement = 0;
winfont.lfOrientation = 0;
winfont.lfUnderline = false;
winfont.lfStrikeOut = false;
winfont.lfCharSet = DEFAULT_CHARSET;
- winfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
+ winfont.lfOutPrecision = OUT_TT_PRECIS;
winfont.lfQuality = 5; // Force cleartype.
winfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
winfont.lfItalic = fontDescription.italic();
LOGFONT winfont;
GetObject(m_font.hfont(), sizeof(LOGFONT), &winfont);
int smallCapsHeight = lroundf(0.70f * fontDescription.computedSize());
- winfont.lfHeight = -WIN32_FONT_LOGICAL_SCALE * smallCapsHeight;
+ winfont.lfHeight = -smallCapsHeight;
HFONT hfont = CreateFontIndirect(&winfont);
m_smallCapsFontData = new FontData(FontPlatformData(hfont, smallCapsHeight));
}
ReleaseDC(0, dc);
const double metricsMultiplier = cairo_win32_scaled_font_get_metrics_factor(scaledFont) * m_font.size();
-
return width * metricsMultiplier;
}
typedef struct _cairo_scaled_font cairo_scaled_font_t;
typedef struct _cairo_font_face cairo_font_face_t;
-#define WIN32_FONT_LOGICAL_SCALE 32
-
namespace WebCore {
class FontDescription;
TEXTMETRIC tm;
GetTextMetrics(dc, &tm);
- if ((tm.tmPitchAndFamily & TMPF_VECTOR) == 0) {
- // The "glyph" for a bitmap font is just the character itself.
- // FIXME: Need to check character ranges and fill in a glyph of 0 for
- // any characters not in range. Otherwise bitmap fonts will never fall
- // back.
- // IMLangFontLink2::GetFontUnicodeRanges does what we want.
- for (unsigned i = 0; i < cGlyphPageSize; i++)
- page->setGlyphDataForIndex(i, buffer[i], fontData);
- } else {
- WORD localGlyphBuffer[cGlyphPageSize];
- GetGlyphIndices(dc, buffer, bufferLength, localGlyphBuffer, 0);
-
- for (unsigned i = 0; i < cGlyphPageSize; i++)
- page->setGlyphDataForIndex(i, localGlyphBuffer[i], fontData);
- }
-
+ WORD localGlyphBuffer[cGlyphPageSize];
+ GetGlyphIndices(dc, buffer, bufferLength, localGlyphBuffer, 0);
+ for (unsigned i = 0; i < cGlyphPageSize; i++)
+ page->setGlyphDataForIndex(i, localGlyphBuffer[i], fontData);
RestoreDC(dc, -1);
ReleaseDC(0, dc);
return true;