[HarfBuzz] harfbuzz: Branch 'master' - 3 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Oct 12 10:02:18 UTC 2017
CMakeLists.txt | 24 +++++++-----------------
src/hb-coretext.cc | 32 +++++++++++++++++++++++++++++---
2 files changed, 36 insertions(+), 20 deletions(-)
New commits:
commit 8923033eb2dab75e9361e9ea1333deb1213393ce
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Oct 12 12:01:48 2017 +0200
[coretext] Use fabs() to silence compiler warning
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 44077050..fbbf56bd 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -80,8 +80,8 @@ hb_coretext_face_create (CGFontRef cg_font)
HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
- fabsf (CTFontGetSize((CTFontRef) data) -
- (font->ptem <= 0 ? HB_CORETEXT_DEFAULT_FONT_SIZE : font->ptem)) <= .5)
+ fabs (CTFontGetSize((CTFontRef) data) -
+ (font->ptem <= 0 ? HB_CORETEXT_DEFAULT_FONT_SIZE : font->ptem)) <= .5)
/*
* shaper face data
commit dd4b321b4a429c6e6a28441ea9ae52f8f9dd1dad
Author: Dominik Röttsches <drott at chromium.org>
Date: Thu Oct 12 11:49:37 2017 +0200
[coretext] Activate tracking for system fonts
Another attempt at fully fixing
https://github.com/behdad/harfbuzz/issues/360
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 2beb5947..44077050 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -150,7 +150,33 @@ create_cg_font (hb_face_t *face)
static CTFontRef
create_ct_font (CGFontRef cg_font, CGFloat font_size)
{
- CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
+ CTFontRef ct_font = NULL;
+
+ /* CoreText does not enable trak table usage / tracking when creating a CTFont
+ * using CTFontCreateWithGraphicsFont. The only way of enabling tracking seems
+ * to be through the CTFontCreateUIFontForLanguage call. */
+ CFStringRef cg_postscript_name = CGFontCopyPostScriptName (cg_font);
+ if (CFStringHasPrefix (cg_postscript_name, CFSTR (".SFNSText")) ||
+ CFStringHasPrefix (cg_postscript_name, CFSTR (".SFNSDisplay")))
+ {
+ CTFontUIFontType font_type = kCTFontUIFontSystem;
+ if (CFStringHasSuffix (cg_postscript_name, CFSTR ("-Bold")))
+ font_type = kCTFontUIFontEmphasizedSystem;
+
+ ct_font = CTFontCreateUIFontForLanguage (font_type, font_size, NULL);
+ CFStringRef ct_result_name = CTFontCopyPostScriptName(ct_font);
+ if (CFStringCompare (ct_result_name, cg_postscript_name, 0) != kCFCompareEqualTo)
+ {
+ CFRelease(ct_font);
+ ct_font = NULL;
+ }
+ CFRelease (ct_result_name);
+ }
+ CFRelease (cg_postscript_name);
+
+ if (!ct_font)
+ ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
+
if (unlikely (!ct_font)) {
DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
return NULL;
commit 6760021d6f4beef852c6560607b32090bcfa5acb
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Thu Oct 12 12:05:08 2017 +0300
CMakelists.txt fix for Freetype builds (#564)
Instead of searching for freetype using pkg-config, use the FindFreetype
feature of CMake. This allows for better integration with other projects
that make use of CMake.
Fixes https://github.com/behdad/harfbuzz/issues/518
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee313566..650def81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,29 +183,19 @@ set(project_headers
## Find and include needed header folders and libraries
if (HB_HAVE_FREETYPE)
- add_definitions(-DHAVE_FREETYPE=1 -DHAVE_FT_FACE_GETCHARVARIANTINDEX=1)
- # https://github.com/WebKit/webkit/blob/master/Source/cmake/FindFreetype2.cmake
- find_package(PkgConfig)
- pkg_check_modules(PC_FREETYPE2 QUIET freetype2)
+ include(FindFreetype)
+ if (NOT FREETYPE_FOUND)
+ message(FATAL_ERROR "HB_HAVE_FREETYPE was set, but we failed to find it. Maybe add a CMAKE_PREFIX_PATH= to your Freetype2 install prefix")
+ endif()
- find_path(FREETYPE2_HEADER_DIR NAMES freetype.h HINTS ${PC_FREETYPE2_INCLUDE_DIRS} ${PC_FREETYPE2_INCLUDEDIR} $ENV{FREETYPE_DIR}/include PATH_SUFFIXES freetype)
- find_path(FREETYPE2_ROOT_INCLUDE_DIR NAMES freetype/freetype.h HINTS ${PC_FREETYPE2_INCLUDE_DIRS} ${PC_FREETYPE2_INCLUDEDIR} $ENV{FREETYPE_DIR}/include)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- set(FREETYPE2_LIBRARY_NAME freetyped)
- else ()
- set(FREETYPE2_LIBRARY_NAME freetype)
- endif ()
- find_library(FREETYPE2_LIBRARIES ${FREETYPE2_LIBRARY_NAME} HINTS ${PC_FREETYPE2_LIBDIR} ${PC_FREETYPE2_LIBRARY_DIRS} $ENV{FREETYPE_DIR}/lib)
-
- include_directories(AFTER ${FREETYPE2_HEADER_DIR} ${FREETYPE2_ROOT_INCLUDE_DIR})
+ list(APPEND THIRD_PARTY_LIBS ${FREETYPE_LIBRARIES})
+ include_directories(AFTER ${FREETYPE_INCLUDE_DIRS})
+ add_definitions(-DHAVE_FREETYPE=1 -DHAVE_FT_FACE_GETCHARVARIANTINDEX=1)
list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-ft.cc)
list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-ft.h)
- list(APPEND THIRD_PARTY_LIBS ${FREETYPE2_LIBRARIES})
-
- mark_as_advanced(FREETYPE2_HEADER_DIR FREETYPE2_ROOT_INCLUDE_DIR FREETYPE2_LIBRARIES)
endif ()
if (HB_HAVE_GRAPHITE2)
More information about the HarfBuzz
mailing list