Skip to content

Instantly share code, notes, and snippets.

@bratsche
Created December 4, 2015 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bratsche/0b33d49a317c604fe261 to your computer and use it in GitHub Desktop.
Save bratsche/0b33d49a317c604fe261 to your computer and use it in GitHub Desktop.
Cairo Win32 font changes for device scale
--- a/src/win32/cairo-win32-font.c
+++ b/src/win32/cairo-win32-font.c
@@ -379,6 +379,8 @@ _win32_scaled_font_create (LOGFONTW *logfont,
/* don't delete the hfont if we're using the one passed in to us */
f->delete_scaled_hfont = !f->scaled_hfont;
+ cairo_matrix_scale (font_matrix, 1.0 / device_scale, 1.0 / device_scale);
+ cairo_matrix_scale (ctm, device_scale, device_scale);
cairo_matrix_multiply (&scale, font_matrix, ctm);
status = _compute_transform (f, &scale);
if (status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment