emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 222a5207c4d 2/2: ; Minor fixes to last changes


From: Eli Zaretskii
Subject: master 222a5207c4d 2/2: ; Minor fixes to last changes
Date: Fri, 25 Oct 2024 07:37:38 -0400 (EDT)

branch: master
commit 222a5207c4d8fa31103637018ae0a7bdb74dd660
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    ; Minor fixes to last changes
    
    * src/w32font.h:
    * src/w32font.c:
    * src/w32dwrite.c:
    * etc/NEWS: Minor fixes of last changes.  (Bug#73730)
---
 etc/NEWS        |  7 +++++--
 src/w32dwrite.c | 33 +++++++++++++++++----------------
 src/w32font.c   |  4 ++--
 src/w32font.h   |  2 +-
 4 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 108d96014db..18b6678dce9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -790,8 +790,11 @@ supported.  As on X, the user options 'dnd-scroll-margin' 
and
 On Windows 8.1 and later versions Emacs now uses DirectWrite to draw
 text, which supports color fonts.  This can be disabled by setting the
 variable 'w32-inhibit-dwrite' to t.  Also see 'w32-dwrite-available' and
-'w32-dwrite-reinit' to check availability and to configure render
-parameters.
+'w32-dwrite-reinit' to check availability and to configure the
+DirectWrite rendering parameters.
+
+To show color Emoji in Emacs, customize the default fontset to use a
+color Emoji font installed on your system for the 'emoji' script.
 
 
 ----------------------------------------------------------------------
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 {
 interface IDWriteFactory2 {
   CONST_VTBL IDWriteFactory2Vtbl* lpVtbl;
 };
-#else /* ifndef MINGW_W64 */
+#else /* MINGW_W64 */
 # include <dwrite_3.h>
 #endif
 
-/* User configurable variables.  If they are lower than 0 use
+/* User configurable variables.  If they are smaller than 0, use
    DirectWrite's defaults, or our defaults.  To set them, the user calls
    'w32-dwrite-reinit' */
 static float config_enhanced_contrast = -1.0f;
@@ -495,7 +495,7 @@ release_com (IUnknown **i)
     }
 }
 
-#define RELEASE_COM(i) release_com ( (IUnknown **) &i )
+#define RELEASE_COM(i) release_com ((IUnknown **) &i)
 
 /* Global variables for DirectWrite.  */
 static bool direct_write_available = false;
@@ -516,7 +516,7 @@ verify_hr (HRESULT hr, const char *msg)
   return true;
 }
 
-/* Gets a IDWriteFontFace from a struct font (its HFONT). Returns the
+/* Gets a IDWriteFontFace from a struct font (its HFONT).  Returns the
    font size in points.  It may fail to get a DirectWrite font, and face
    will be NULL on return.  This happens for some fonts like Courier.
 
@@ -560,10 +560,10 @@ get_font_face (struct font *infont, IDWriteFontFace 
**face)
     }
 
   /* Cache this FontFace.  */
-  uniscribe_font->dwrite_font_size = abs (logfont.lfHeight);
+  uniscribe_font->dwrite_font_size = eabs (logfont.lfHeight);
   uniscribe_font->dwrite_cache = *face;
 
-  return abs (logfont.lfHeight);
+  return eabs (logfont.lfHeight);
 }
 
 void
@@ -642,7 +642,7 @@ text_extents_internal (IDWriteFontFace *dwrite_font_face,
       if (metrics->rbearing < rbearing)
        metrics->rbearing = rbearing;
     }
-  metrics->width = round(width);
+  metrics->width = round (width);
   SAFE_FREE ();
   return true;
 }
@@ -794,7 +794,6 @@ w32_initialize_direct_write (void)
       DebPrint (("DirectWrite HRESULT failed: (%d) QueryInterface 
IDWriteFactory2\n", hr));
       RELEASE_COM (dwrite_factory);
       FreeLibrary (direct_write);
-      eassert (SUCCEEDED (hr));
       return;
     }
 
@@ -939,12 +938,12 @@ w32_dwrite_draw (HDC hdc, int x, int y, unsigned *glyphs, 
int len,
   glyph_run.glyphIndices = indices;
   glyph_run.glyphCount = len;
   glyph_run.isSideways = false;
-  glyph_run.bidiLevel = 0;
+  glyph_run.bidiLevel = 0;     /* we reorder bidi text ourselves */
   glyph_run.glyphOffsets = NULL;
   glyph_run.glyphAdvances = advances;
 
   IDWriteColorGlyphRunEnumerator *layers;
-  /* This call will tell us if we hace to handle any color glyph.  */
+  /* This call will tell us if we have to handle any color glyphs.  */
   hr = dwrite_factory2->lpVtbl->TranslateColorGlyphRun (dwrite_factory2,
                                                        0, font->ascent,
                                                        &glyph_run,
@@ -965,8 +964,8 @@ w32_dwrite_draw (HDC hdc, int x, int y, unsigned *glyphs, 
int len,
                                                NULL);
   else
     {
-      /* If there were color glyphs, layers contains a list of GlyphRun
-        with a color and a position for each.  We draw them
+      /* If there were color glyphs, 'layers' contains a list of
+        GlyphRun with a color and a position for each.  We draw them
         individually.  */
       if (!verify_hr (hr, "Failed at TranslateColorGlyphRun"))
        {
@@ -1057,11 +1056,13 @@ DirectWrite will be used if it is available and 
'w32-inhibit-dwrite' is nil.  */
 DEFUN ("w32-dwrite-reinit", Fw32_dwrite_reinit, Sw32_dwrite_reinit, 0, 3, 0,
        doc: /* Reinitialize DirectWrite with the given parameters.
 If a parameter is not specified, or is out of range, it will take a default
-value. Returns nil.
+value.
+
+Return value is nil.
 
-ENHANCED_CONTRAST is in the range [0.0, 1.0]
-CLEAR_TYPE_LEVEL is in the range [0.0, 1.0]
-GAMMA is in the range (0.0, 256.0]  */)
+ENHANCED_CONTRAST is in the range [0.0, 1.0], and defaults to 0.0.
+CLEAR_TYPE_LEVEL is in the range [0.0, 1.0], and defaults to 0.0.
+GAMMA is in the range (0.0, 256.0], and defaults to 2.2.  */)
   (Lisp_Object enhanced_contrast, Lisp_Object clear_type_level,
    Lisp_Object gamma)
 {
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,
       for (i = 0; i < len; i++)
        if (!w32_use_direct_write (w32font) ||
            !w32_dwrite_draw (s->hdc, x, y, s->char2b + from, 1,
-                             GetTextColor(s->hdc), s->font))
+                             GetTextColor (s->hdc), s->font))
          {
            WCHAR c = s->char2b[from + i] & 0xFFFF;
            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,
     {
       if (!w32_use_direct_write (w32font) ||
          !w32_dwrite_draw (s->hdc, x, y,
-                           s->char2b + from, len, GetTextColor(s->hdc),
+                           s->char2b + from, len, GetTextColor (s->hdc),
                            s->font))
        {
          /* 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,
 bool w32_dwrite_text_extents (struct font *font, const unsigned *code,
                              int nglyphs, struct font_metrics *metrics);
 unsigned w32_dwrite_encode_char (struct font *font, int c);
-void w32_dwrite_free_cached_face(void *cache);
+void w32_dwrite_free_cached_face (void *cache);
 void syms_of_w32dwrite (void);
 
 extern void globals_of_w32font (void);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]