[HarfBuzz] harfbuzz-ng: Branch 'master' - 8 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Sat Sep 17 07:01:10 PDT 2011
TODO | 6 ++++++
configure.ac | 2 +-
src/hb-object-private.hh | 26 +++++++++++++++-----------
src/hb-ot-shape-normalize.cc | 4 ++--
src/hb-private.hh | 2 +-
src/hb-unicode-private.hh | 4 ++--
src/test.cc | 4 ++--
util/common.hh | 2 +-
util/options.cc | 12 ++++++------
util/view-cairo.cc | 37 +++++++++++++++++++++++++++++--------
10 files changed, 65 insertions(+), 34 deletions(-)
New commits:
commit 0fe296019746689551d224a5f6fb7e0ebe1b91dc
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Sep 17 09:59:58 2011 -0400
Fix Linux build when io.h is available
Bug 40953 - fail compile git: make[2]: *** [hb_view-options.o] Error 1
diff --git a/configure.ac b/configure.ac
index e1b6bf8..ac41742 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ AC_SUBST(HB_LIBTOOL_VERSION_INFO)
GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
# Functions and headers
-AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap)
+AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap _setmode)
AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
# Compiler flags
diff --git a/util/options.cc b/util/options.cc
index a923a98..fe2feaf 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -439,8 +439,8 @@ font_options_t::get_font (void) const
/* read it */
GString *gs = g_string_new (NULL);
char buf[BUFSIZ];
-#ifdef HAVE_IO_H
- _setmode (fileno (stdin), O_BINARY);
+#ifdef HAVE__SETMODE
+ _setmode (fileno (stdin), _O_BINARY);
#endif
while (!feof (stdin)) {
size_t ret = fread (buf, 1, sizeof (buf), stdin);
@@ -579,8 +579,8 @@ output_options_t::get_file_handle (void)
if (output_file)
fp = fopen (output_file, "wb");
else {
-#ifdef HAVE_IO_H
- _setmode (fileno (stdout), O_BINARY);
+#ifdef HAVE__SETMODE
+ _setmode (fileno (stdout), _O_BINARY);
#endif
fp = stdout;
}
commit d2b3ab9ecebbf46cb9dac1f09c17379c50ea4575
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 16:59:17 2011 -0400
Fix "[util] Fix hb-view crash with bogus font."
diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index 33921e9..9ca44c8 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -207,7 +207,7 @@ view_cairo_t::create_scaled_font (const font_options_t *font_opts)
FT_Face ft_face = hb_ft_font_get_face (font);
if (!ft_face)
/* This allows us to get some boxes at least... */
- cairo_face = cairo_toy_font_face_create ("sans",
+ cairo_face = cairo_toy_font_face_create ("@cairo:sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
else
commit da4a2a1426ee3aa9d9678ec12c9ba4dfcba0bcf8
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 16:56:34 2011 -0400
Cosmetic
diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index a3618b0..33921e9 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -187,7 +187,9 @@ view_cairo_t::get_surface_size (cairo_scaled_font_t *scaled_font,
cairo_scaled_font_extents (scaled_font, &font_extents);
- *h = font_extents.ascent + font_extents.descent + ((int) lines->len - 1) * font_extents.height;
+ *h = font_extents.ascent
+ + font_extents.descent
+ + ((int) lines->len - 1) * font_extents.height;
*w = 0;
for (unsigned int i = 0; i < lines->len; i++)
*w = MAX (*w, line_width (i));
@@ -205,25 +207,34 @@ view_cairo_t::create_scaled_font (const font_options_t *font_opts)
FT_Face ft_face = hb_ft_font_get_face (font);
if (!ft_face)
/* This allows us to get some boxes at least... */
- cairo_face = cairo_toy_font_face_create ("sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_face = cairo_toy_font_face_create ("sans",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
else
cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
cairo_matrix_t ctm, font_matrix;
cairo_font_options_t *font_options;
cairo_matrix_init_identity (&ctm);
- cairo_matrix_init_scale (&font_matrix, font_opts->font_size, font_opts->font_size);
+ cairo_matrix_init_scale (&font_matrix,
+ font_opts->font_size, font_opts->font_size);
font_options = cairo_font_options_create ();
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
- cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face, &font_matrix, &ctm, font_options);
+ cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face,
+ &font_matrix,
+ &ctm,
+ font_options);
cairo_font_options_destroy (font_options);
cairo_font_face_destroy (cairo_face);
static cairo_user_data_key_t key;
- if (cairo_scaled_font_set_user_data (scaled_font, &key, (void *) font, (cairo_destroy_func_t) hb_font_destroy))
+ if (cairo_scaled_font_set_user_data (scaled_font,
+ &key,
+ (void *) font,
+ (cairo_destroy_func_t) hb_font_destroy))
hb_font_destroy (font);
return scaled_font;
@@ -285,7 +296,10 @@ _cairo_png_surface_create_for_stream (cairo_write_func_t write_func,
png_closure->write_func = write_func;
png_closure->closure = closure;
- if (cairo_surface_set_user_data (surface, &finalize_closure_key, (void *) png_closure, (cairo_destroy_func_t) g_free))
+ if (cairo_surface_set_user_data (surface,
+ &finalize_closure_key,
+ (void *) png_closure,
+ (cairo_destroy_func_t) g_free))
g_free ((void *) closure);
return surface;
@@ -407,7 +421,8 @@ view_cairo_t::create_context (double w, double h)
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_rgba (cr, 1., 1., 1., br / 255.);
cairo_paint (cr);
- cairo_set_source_rgba (cr, 1., 1., 1., (fr / 255.) * (fa / 255.) + (br / 255) * (1 - (fa / 255.)));
+ cairo_set_source_rgba (cr, 1., 1., 1.,
+ (fr / 255.) * (fa / 255.) + (br / 255) * (1 - (fa / 255.)));
break;
default:
case CAIRO_CONTENT_COLOR:
@@ -458,7 +473,7 @@ view_cairo_t::draw (cairo_t *cr)
}
if (cairo_surface_get_type (cairo_get_target (cr)) == CAIRO_SURFACE_TYPE_IMAGE) {
- /* cairo_show_glyphs() doesn't support subpixel positioining */
+ /* cairo_show_glyphs() doesn't support subpixel positioning */
cairo_glyph_path (cr, l.glyphs, l.num_glyphs);
cairo_fill (cr);
} else
commit 4274ed7ab6fb03fbf8eaaa43ab06647dc0beed79
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 16:52:26 2011 -0400
[util] Fix hb-view crash with bogus font
diff --git a/util/view-cairo.cc b/util/view-cairo.cc
index c639abd..a3618b0 100644
--- a/util/view-cairo.cc
+++ b/util/view-cairo.cc
@@ -201,7 +201,13 @@ view_cairo_t::create_scaled_font (const font_options_t *font_opts)
{
hb_font_t *font = hb_font_reference (font_opts->get_font ());
- cairo_font_face_t *cairo_face = cairo_ft_font_face_create_for_ft_face (hb_ft_font_get_face (font), 0);
+ cairo_font_face_t *cairo_face;
+ FT_Face ft_face = hb_ft_font_get_face (font);
+ if (!ft_face)
+ /* This allows us to get some boxes at least... */
+ cairo_face = cairo_toy_font_face_create ("sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+ else
+ cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
cairo_matrix_t ctm, font_matrix;
cairo_font_options_t *font_options;
commit 5ddd9cc499f2470eca239ae357a5c8a3626c0809
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 16:40:44 2011 -0400
Minor
diff --git a/src/hb-private.hh b/src/hb-private.hh
index b13d9cd..c757e2d 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -29,7 +29,7 @@
#ifndef HB_PRIVATE_HH
#define HB_PRIVATE_HH
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index dace924..2ad8a49 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -90,10 +90,10 @@ struct _hb_unicode_funcs_t {
};
-#if HAVE_GLIB
+#ifdef HAVE_GLIB
extern HB_INTERNAL hb_unicode_funcs_t _hb_glib_unicode_funcs;
#define _hb_unicode_funcs_default _hb_glib_unicode_funcs
-#elif HAVE_ICU
+#elif defined(HAVE_ICU)
extern HB_INTERNAL hb_unicode_funcs_t _hb_icu_unicode_funcs;
#define _hb_unicode_funcs_default _hb_icu_unicode_funcs
#else
diff --git a/src/test.cc b/src/test.cc
index af6a45a..bdf017c 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -93,7 +93,7 @@ main (int argc, char **argv)
hb_font_t *font = hb_font_create (face);
hb_font_set_scale (font, upem, upem);
-#if HAVE_FREETYPE
+#ifdef HAVE_FREETYPE
hb_ft_font_set_funcs (font);
#endif
diff --git a/util/common.hh b/util/common.hh
index 1ce61af..a9a16f4 100644
--- a/util/common.hh
+++ b/util/common.hh
@@ -41,7 +41,7 @@
#include <locale.h>
#include <errno.h>
#include <fcntl.h>
-#if HAVE_IO_H
+#ifdef HAVE_IO_H
#include <io.h> /* for _setmode() under Windows */
#endif
diff --git a/util/options.cc b/util/options.cc
index 582e437..a923a98 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -26,7 +26,7 @@
#include "options.hh"
-#if HAVE_FREETYPE
+#ifdef HAVE_FREETYPE
#include <hb-ft.h>
#endif
@@ -439,7 +439,7 @@ font_options_t::get_font (void) const
/* read it */
GString *gs = g_string_new (NULL);
char buf[BUFSIZ];
-#if HAVE_IO_H
+#ifdef HAVE_IO_H
_setmode (fileno (stdin), O_BINARY);
#endif
while (!feof (stdin)) {
@@ -498,7 +498,7 @@ font_options_t::get_font (void) const
hb_font_set_scale (font, upem, upem);
hb_face_destroy (face);
-#if HAVE_FREETYPE
+#ifdef HAVE_FREETYPE
hb_ft_font_set_funcs (font);
#endif
@@ -579,7 +579,7 @@ output_options_t::get_file_handle (void)
if (output_file)
fp = fopen (output_file, "wb");
else {
-#if HAVE_IO_H
+#ifdef HAVE_IO_H
_setmode (fileno (stdout), O_BINARY);
#endif
fp = stdout;
commit 652d64aa8d32d914bf3ee2f2c451de103fea8fa9
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 16:34:39 2011 -0400
TODO items
diff --git a/TODO b/TODO
index 81a0afb..d11c0a2 100644
--- a/TODO
+++ b/TODO
@@ -9,6 +9,12 @@ General fixes:
* init/medi/fina/isol for non-cursive scripts
* vkna,hkna etc for kana, *jmo for hangul, etc
+- Move non-native direction and normalization handling to the generic non-OT
+ layer, such that uniscribe and other backends can use.
+
+- Uniscribe backend needs to enforce one direction only, otherwise cluster
+ values can confused the user.
+
API issues to fix before 1.0:
============================
commit 947c9a778c0d4b428b58806f98c34ede59b7439c
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 16:33:18 2011 -0400
Minor
diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index eb0fb43..f695c49 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -38,7 +38,7 @@
* composed (NFC).
*
* In general what happens is that: each grapheme is decomposed in a chain
- * of 1:2 decompositions, marks reordered, and then recomposed if desires,
+ * of 1:2 decompositions, marks reordered, and then recomposed if desired,
* so far it's like Unicode Normalization. However, the decomposition and
* recomposition only happens if the font supports the resulting characters.
*
@@ -52,7 +52,7 @@
* though their NFC may be different.
*
* - When a font has a precomposed character for a sequence but the 'ccmp'
- * feature in the font is not adequate, form use the precomposed character
+ * feature in the font is not adequate, use the precomposed character
* which typically has better mark positioning.
*
* - When a font does not support a character but supports its decomposition,
commit d5476a30a10da5e54783c8dbf04340225a9a00d7
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 16 12:30:50 2011 -0400
Minor
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index adaa6e8..72ed8ba 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -54,9 +54,13 @@
#include <glib.h>
typedef volatile int hb_atomic_int_t;
-#define hb_atomic_int_fetch_and_add(AI, V) g_atomic_int_exchange_and_add (&(AI), V)
-#define hb_atomic_int_get(AI) g_atomic_int_get (&(AI))
-#define hb_atomic_int_set(AI, V) g_atomic_int_set (&(AI), V)
+#if GLIB_CHECK_VERSION(2,29,5)
+#define hb_atomic_int_add(AI, V) g_atomic_int_add (&(AI), V)
+#else
+#define hb_atomic_int_add(AI, V) g_atomic_int_exchange_and_add (&(AI), V)
+#endif
+#define hb_atomic_int_get(AI) g_atomic_int_get (&(AI))
+#define hb_atomic_int_set(AI, V) g_atomic_int_set (&(AI), V)
#elif defined(_MSC_VER)
@@ -64,9 +68,9 @@ typedef volatile int hb_atomic_int_t;
#include <intrin.h>
typedef long hb_atomic_int_t;
-#define hb_atomic_int_fetch_and_add(AI, V) _InterlockedExchangeAdd (&(AI), V)
-#define hb_atomic_int_get(AI) (_ReadBarrier (), (AI))
-#define hb_atomic_int_set(AI, V) ((void) _InterlockedExchange (&(AI), (V)))
+#define hb_atomic_int_add(AI, V) _InterlockedExchangeAdd (&(AI), V)
+#define hb_atomic_int_get(AI) (_ReadBarrier (), (AI))
+#define hb_atomic_int_set(AI, V) ((void) _InterlockedExchange (&(AI), (V)))
#else
@@ -74,9 +78,9 @@ typedef long hb_atomic_int_t;
#warning "Could not find any system to define atomic_int macros, library will NOT be thread-safe"
typedef volatile int hb_atomic_int_t;
-#define hb_atomic_int_fetch_and_add(AI, V) ((AI) += (V), (AI) - (V))
-#define hb_atomic_int_get(AI) (AI)
-#define hb_atomic_int_set(AI, V) ((void) ((AI) = (V)))
+#define hb_atomic_int_add(AI, V) ((AI) += (V), (AI) - (V))
+#define hb_atomic_int_get(AI) (AI)
+#define hb_atomic_int_set(AI, V) ((void) ((AI) = (V)))
#endif
@@ -93,8 +97,8 @@ typedef struct {
#define HB_REFERENCE_COUNT_INVALID {HB_REFERENCE_COUNT_INVALID_VALUE}
inline void init (int v) { ref_count = v; /* non-atomic is fine */ }
- inline int inc (void) { return hb_atomic_int_fetch_and_add (ref_count, 1); }
- inline int dec (void) { return hb_atomic_int_fetch_and_add (ref_count, -1); }
+ inline int inc (void) { return hb_atomic_int_add (ref_count, 1); }
+ inline int dec (void) { return hb_atomic_int_add (ref_count, -1); }
inline void set (int v) { hb_atomic_int_set (ref_count, v); }
inline int get (void) const { return hb_atomic_int_get (ref_count); }
More information about the HarfBuzz
mailing list