[pango/fix-707: 5/6] Revert "PangoWin32: Use HarfBuzz platform APIs if available"
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-707: 5/6] Revert "PangoWin32: Use HarfBuzz platform APIs if available"
- Date: Mon, 17 Oct 2022 03:48:56 +0000 (UTC)
commit 15e31e915d6cd86028350dcf18602f9b212fabd7
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Oct 17 11:22:19 2022 +0800
Revert "PangoWin32: Use HarfBuzz platform APIs if available"
It turned out that there were issues in regards to building HarfBuzz as
a fallback dependency, so we retain using only the former method to
create the hb_face_t using only raw data, which does not depend on
platform API usage in HarfBuzz.
Hence, reduce the clutter in the build files a bit, which was a
necessary evil back in time.
This reverts commit 6b0aa77d23ac969c12eab00b178957a63befe5bd.
pango/pangowin32-dwrite-fontmap.cpp | 12 ------------
pango/pangowin32-private.h | 2 --
pango/pangowin32.c | 39 +++++--------------------------------
3 files changed, 5 insertions(+), 48 deletions(-)
---
diff --git a/pango/pangowin32-dwrite-fontmap.cpp b/pango/pangowin32-dwrite-fontmap.cpp
index 6e1d9f0ac..a2c03675c 100644
--- a/pango/pangowin32-dwrite-fontmap.cpp
+++ b/pango/pangowin32-dwrite-fontmap.cpp
@@ -25,10 +25,6 @@
#include <initguid.h>
#include <dwrite_1.h>
-#ifdef HAVE_HARFBUZZ_DIRECT_WRITE
-#include <hb-directwrite.h>
-#endif
-
#ifdef STRICT
#undef STRICT
#endif
@@ -563,14 +559,6 @@ pango_win32_dwrite_font_check_is_hinted (PangoWin32Font *font)
return result;
}
-#ifdef HAVE_HARFBUZZ_DIRECT_WRITE
-hb_face_t *
-pango_win32_dwrite_font_face_create_hb_face (gpointer face)
-{
- return hb_directwrite_face_create ((IDWriteFontFace *)face);
-}
-#endif
-
void
pango_win32_dwrite_font_release (gpointer dwrite_font)
{
diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h
index f69d2b6b5..1502ecd92 100644
--- a/pango/pangowin32-private.h
+++ b/pango/pangowin32-private.h
@@ -321,8 +321,6 @@ gpointer pango_win32_logfontw_get_dwrite_font (LOGFONTW
PangoFontDescription *
pango_win32_font_description_from_logfontw_dwrite (const LOGFONTW *logfontw);
-hb_face_t *pango_win32_dwrite_font_face_create_hb_face (gpointer face);
-
G_END_DECLS
#endif /* __PANGOWIN32_PRIVATE_H__ */
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 09b97a558..5a26ee98b 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -29,10 +29,6 @@
#include <glib.h>
#include <hb.h>
-#if defined (HAVE_HARFBUZZ_GDI)
-#include <hb-gdi.h>
-#endif
-
#include "pango-impl-utils.h"
#include "pangowin32.h"
#include "pangowin32-private.h"
@@ -1289,45 +1285,20 @@ hfont_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data)
static hb_font_t *
pango_win32_font_create_hb_font (PangoFont *font)
{
- PangoWin32Font *win32font = PANGO_WIN32_FONT (font);
- HFONT hfont = NULL;
+ PangoWin32Font *win32font = (PangoWin32Font *)font;
+ HFONT hfont;
hb_face_t *face = NULL;
hb_font_t *hb_font = NULL;
- static const hb_user_data_key_t key;
- hb_destroy_func_t destroy_func = NULL;
- void *destroy_obj = NULL;
- gpointer dwrite_font_face = NULL;
g_return_val_if_fail (font != NULL, NULL);
-#ifdef HAVE_HARFBUZZ_DIRECT_WRITE
- dwrite_font_face = pango_win32_font_get_dwrite_font_face (win32font);
-
- if (dwrite_font_face != NULL)
- {
- face = pango_win32_dwrite_font_face_create_hb_face (dwrite_font_face);
- destroy_func = pango_win32_dwrite_font_face_release;
- destroy_obj = dwrite_font_face;
- }
-#endif
- if (face == NULL)
- {
- hfont = _pango_win32_font_get_hfont (font);
+ hfont = _pango_win32_font_get_hfont (font);
-#ifdef HAVE_HARFBUZZ_GDI
- face = hb_gdi_face_create (hfont);
-#else
- face = hb_face_create_for_tables (hfont_reference_table, (void *)hfont, NULL);
-#endif
- }
+ /* We are *not* allowed to destroy the HFONT here ! */
+ face = hb_face_create_for_tables (hfont_reference_table, (void *)hfont, NULL);
hb_font = hb_font_create (face);
hb_font_set_scale (hb_font, win32font->size, win32font->size);
-
- /* We are supposed to destroy the IDWriteFontFace, but *not* the HFONT! */
- if (destroy_func != NULL && destroy_obj != NULL)
- hb_font_set_user_data (hb_font, &key, destroy_obj, destroy_func, TRUE);
-
hb_face_destroy (face);
return hb_font;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]