diff options
| author | Eli Zaretskii | 2024-10-25 14:36:41 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-10-25 14:36:41 +0300 |
| commit | 222a5207c4d8fa31103637018ae0a7bdb74dd660 (patch) | |
| tree | e754b0aa604e4f981d1d9233e4ffb6e3761ec0ea /src | |
| parent | edf37e811cafa4092b13969613fa83f6e6d69ab3 (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/w32dwrite.c | 33 | ||||
| -rw-r--r-- | src/w32font.c | 4 | ||||
| -rw-r--r-- | src/w32font.h | 2 |
3 files changed, 20 insertions, 19 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 { | |||
| 469 | interface IDWriteFactory2 { | 469 | interface 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' */ |
| 479 | static float config_enhanced_contrast = -1.0f; | 479 | static 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. */ |
| 501 | static bool direct_write_available = false; | 501 | static 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 | ||
| 569 | void | 569 | void |
| @@ -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. */ | |||
| 1057 | DEFUN ("w32-dwrite-reinit", Fw32_dwrite_reinit, Sw32_dwrite_reinit, 0, 3, 0, | 1056 | DEFUN ("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. |
| 1059 | If a parameter is not specified, or is out of range, it will take a default | 1058 | If a parameter is not specified, or is out of range, it will take a default |
| 1060 | value. Returns nil. | 1059 | value. |
| 1060 | |||
| 1061 | Return value is nil. | ||
| 1061 | 1062 | ||
| 1062 | ENHANCED_CONTRAST is in the range [0.0, 1.0] | 1063 | ENHANCED_CONTRAST is in the range [0.0, 1.0], and defaults to 0.0. |
| 1063 | CLEAR_TYPE_LEVEL is in the range [0.0, 1.0] | 1064 | CLEAR_TYPE_LEVEL is in the range [0.0, 1.0], and defaults to 0.0. |
| 1064 | GAMMA is in the range (0.0, 256.0] */) | 1065 | GAMMA 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 | { |
diff --git a/src/w32font.c b/src/w32font.c index 05e5a067f20..a6a6a4459a3 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -712,7 +712,7 @@ w32font_draw (struct glyph_string *s, int from, int to, | |||
| 712 | for (i = 0; i < len; i++) | 712 | for (i = 0; i < len; i++) |
| 713 | if (!w32_use_direct_write (w32font) || | 713 | if (!w32_use_direct_write (w32font) || |
| 714 | !w32_dwrite_draw (s->hdc, x, y, s->char2b + from, 1, | 714 | !w32_dwrite_draw (s->hdc, x, y, s->char2b + from, 1, |
| 715 | GetTextColor(s->hdc), s->font)) | 715 | GetTextColor (s->hdc), s->font)) |
| 716 | { | 716 | { |
| 717 | WCHAR c = s->char2b[from + i] & 0xFFFF; | 717 | WCHAR c = s->char2b[from + i] & 0xFFFF; |
| 718 | ExtTextOutW (s->hdc, x + i, y, options, NULL, &c, 1, NULL); | 718 | ExtTextOutW (s->hdc, x + i, y, options, NULL, &c, 1, NULL); |
| @@ -722,7 +722,7 @@ w32font_draw (struct glyph_string *s, int from, int to, | |||
| 722 | { | 722 | { |
| 723 | if (!w32_use_direct_write (w32font) || | 723 | if (!w32_use_direct_write (w32font) || |
| 724 | !w32_dwrite_draw (s->hdc, x, y, | 724 | !w32_dwrite_draw (s->hdc, x, y, |
| 725 | s->char2b + from, len, GetTextColor(s->hdc), | 725 | s->char2b + from, len, GetTextColor (s->hdc), |
| 726 | s->font)) | 726 | s->font)) |
| 727 | { | 727 | { |
| 728 | /* The number of glyphs in a glyph_string cannot be larger than | 728 | /* The number of glyphs in a glyph_string cannot be larger than |
diff --git a/src/w32font.h b/src/w32font.h index 75e63e4a32e..74552a5bee5 100644 --- a/src/w32font.h +++ b/src/w32font.h | |||
| @@ -112,7 +112,7 @@ bool w32_dwrite_draw (HDC hdc, int x, int y, unsigned *glyphs, int len, | |||
| 112 | bool w32_dwrite_text_extents (struct font *font, const unsigned *code, | 112 | bool w32_dwrite_text_extents (struct font *font, const unsigned *code, |
| 113 | int nglyphs, struct font_metrics *metrics); | 113 | int nglyphs, struct font_metrics *metrics); |
| 114 | unsigned w32_dwrite_encode_char (struct font *font, int c); | 114 | unsigned w32_dwrite_encode_char (struct font *font, int c); |
| 115 | void w32_dwrite_free_cached_face(void *cache); | 115 | void w32_dwrite_free_cached_face (void *cache); |
| 116 | void syms_of_w32dwrite (void); | 116 | void syms_of_w32dwrite (void); |
| 117 | 117 | ||
| 118 | extern void globals_of_w32font (void); | 118 | extern void globals_of_w32font (void); |