aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32dwrite.c
diff options
context:
space:
mode:
authorEli Zaretskii2024-10-25 14:36:41 +0300
committerEli Zaretskii2024-10-25 14:36:41 +0300
commit222a5207c4d8fa31103637018ae0a7bdb74dd660 (patch)
treee754b0aa604e4f981d1d9233e4ffb6e3761ec0ea /src/w32dwrite.c
parentedf37e811cafa4092b13969613fa83f6e6d69ab3 (diff)
downloademacs-222a5207c4d8fa31103637018ae0a7bdb74dd660.tar.gz
emacs-222a5207c4d8fa31103637018ae0a7bdb74dd660.zip
; Minor fixes to last changes
* src/w32font.h: * src/w32font.c: * src/w32dwrite.c: * etc/NEWS: Minor fixes of last changes. (Bug#73730)
Diffstat (limited to 'src/w32dwrite.c')
-rw-r--r--src/w32dwrite.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/w32dwrite.c b/src/w32dwrite.c
index 9f7b8d96977..1f5eba19a40 100644
--- a/src/w32dwrite.c
+++ b/src/w32dwrite.c
@@ -469,11 +469,11 @@ typedef struct IDWriteFactory2Vtbl {
469interface IDWriteFactory2 { 469interface IDWriteFactory2 {
470 CONST_VTBL IDWriteFactory2Vtbl* lpVtbl; 470 CONST_VTBL IDWriteFactory2Vtbl* lpVtbl;
471}; 471};
472#else /* ifndef MINGW_W64 */ 472#else /* MINGW_W64 */
473# include <dwrite_3.h> 473# include <dwrite_3.h>
474#endif 474#endif
475 475
476/* User configurable variables. If they are lower than 0 use 476/* User configurable variables. If they are smaller than 0, use
477 DirectWrite's defaults, or our defaults. To set them, the user calls 477 DirectWrite's defaults, or our defaults. To set them, the user calls
478 'w32-dwrite-reinit' */ 478 'w32-dwrite-reinit' */
479static float config_enhanced_contrast = -1.0f; 479static float config_enhanced_contrast = -1.0f;
@@ -495,7 +495,7 @@ release_com (IUnknown **i)
495 } 495 }
496} 496}
497 497
498#define RELEASE_COM(i) release_com ( (IUnknown **) &i ) 498#define RELEASE_COM(i) release_com ((IUnknown **) &i)
499 499
500/* Global variables for DirectWrite. */ 500/* Global variables for DirectWrite. */
501static bool direct_write_available = false; 501static bool direct_write_available = false;
@@ -516,7 +516,7 @@ verify_hr (HRESULT hr, const char *msg)
516 return true; 516 return true;
517} 517}
518 518
519/* Gets a IDWriteFontFace from a struct font (its HFONT). Returns the 519/* Gets a IDWriteFontFace from a struct font (its HFONT). Returns the
520 font size in points. It may fail to get a DirectWrite font, and face 520 font size in points. It may fail to get a DirectWrite font, and face
521 will be NULL on return. This happens for some fonts like Courier. 521 will be NULL on return. This happens for some fonts like Courier.
522 522
@@ -560,10 +560,10 @@ get_font_face (struct font *infont, IDWriteFontFace **face)
560 } 560 }
561 561
562 /* Cache this FontFace. */ 562 /* Cache this FontFace. */
563 uniscribe_font->dwrite_font_size = abs (logfont.lfHeight); 563 uniscribe_font->dwrite_font_size = eabs (logfont.lfHeight);
564 uniscribe_font->dwrite_cache = *face; 564 uniscribe_font->dwrite_cache = *face;
565 565
566 return abs (logfont.lfHeight); 566 return eabs (logfont.lfHeight);
567} 567}
568 568
569void 569void
@@ -642,7 +642,7 @@ text_extents_internal (IDWriteFontFace *dwrite_font_face,
642 if (metrics->rbearing < rbearing) 642 if (metrics->rbearing < rbearing)
643 metrics->rbearing = rbearing; 643 metrics->rbearing = rbearing;
644 } 644 }
645 metrics->width = round(width); 645 metrics->width = round (width);
646 SAFE_FREE (); 646 SAFE_FREE ();
647 return true; 647 return true;
648} 648}
@@ -794,7 +794,6 @@ w32_initialize_direct_write (void)
794 DebPrint (("DirectWrite HRESULT failed: (%d) QueryInterface IDWriteFactory2\n", hr)); 794 DebPrint (("DirectWrite HRESULT failed: (%d) QueryInterface IDWriteFactory2\n", hr));
795 RELEASE_COM (dwrite_factory); 795 RELEASE_COM (dwrite_factory);
796 FreeLibrary (direct_write); 796 FreeLibrary (direct_write);
797 eassert (SUCCEEDED (hr));
798 return; 797 return;
799 } 798 }
800 799
@@ -939,12 +938,12 @@ w32_dwrite_draw (HDC hdc, int x, int y, unsigned *glyphs, int len,
939 glyph_run.glyphIndices = indices; 938 glyph_run.glyphIndices = indices;
940 glyph_run.glyphCount = len; 939 glyph_run.glyphCount = len;
941 glyph_run.isSideways = false; 940 glyph_run.isSideways = false;
942 glyph_run.bidiLevel = 0; 941 glyph_run.bidiLevel = 0; /* we reorder bidi text ourselves */
943 glyph_run.glyphOffsets = NULL; 942 glyph_run.glyphOffsets = NULL;
944 glyph_run.glyphAdvances = advances; 943 glyph_run.glyphAdvances = advances;
945 944
946 IDWriteColorGlyphRunEnumerator *layers; 945 IDWriteColorGlyphRunEnumerator *layers;
947 /* This call will tell us if we hace to handle any color glyph. */ 946 /* This call will tell us if we have to handle any color glyphs. */
948 hr = dwrite_factory2->lpVtbl->TranslateColorGlyphRun (dwrite_factory2, 947 hr = dwrite_factory2->lpVtbl->TranslateColorGlyphRun (dwrite_factory2,
949 0, font->ascent, 948 0, font->ascent,
950 &glyph_run, 949 &glyph_run,
@@ -965,8 +964,8 @@ w32_dwrite_draw (HDC hdc, int x, int y, unsigned *glyphs, int len,
965 NULL); 964 NULL);
966 else 965 else
967 { 966 {
968 /* If there were color glyphs, layers contains a list of GlyphRun 967 /* If there were color glyphs, 'layers' contains a list of
969 with a color and a position for each. We draw them 968 GlyphRun with a color and a position for each. We draw them
970 individually. */ 969 individually. */
971 if (!verify_hr (hr, "Failed at TranslateColorGlyphRun")) 970 if (!verify_hr (hr, "Failed at TranslateColorGlyphRun"))
972 { 971 {
@@ -1057,11 +1056,13 @@ DirectWrite will be used if it is available and 'w32-inhibit-dwrite' is nil. */
1057DEFUN ("w32-dwrite-reinit", Fw32_dwrite_reinit, Sw32_dwrite_reinit, 0, 3, 0, 1056DEFUN ("w32-dwrite-reinit", Fw32_dwrite_reinit, Sw32_dwrite_reinit, 0, 3, 0,
1058 doc: /* Reinitialize DirectWrite with the given parameters. 1057 doc: /* Reinitialize DirectWrite with the given parameters.
1059If a parameter is not specified, or is out of range, it will take a default 1058If a parameter is not specified, or is out of range, it will take a default
1060value. Returns nil. 1059value.
1060
1061Return value is nil.
1061 1062
1062ENHANCED_CONTRAST is in the range [0.0, 1.0] 1063ENHANCED_CONTRAST is in the range [0.0, 1.0], and defaults to 0.0.
1063CLEAR_TYPE_LEVEL is in the range [0.0, 1.0] 1064CLEAR_TYPE_LEVEL is in the range [0.0, 1.0], and defaults to 0.0.
1064GAMMA is in the range (0.0, 256.0] */) 1065GAMMA is in the range (0.0, 256.0], and defaults to 2.2. */)
1065 (Lisp_Object enhanced_contrast, Lisp_Object clear_type_level, 1066 (Lisp_Object enhanced_contrast, Lisp_Object clear_type_level,
1066 Lisp_Object gamma) 1067 Lisp_Object gamma)
1067{ 1068{