Hide backend-specific shape functions

Also remove shaper_options argument to hb_shape_full().  That was
unused and for "future".  Let it go.

More shaper API coming in preparation for plan/planned API.
This commit is contained in:
Behdad Esfahbod 2012-04-12 14:53:53 -04:00
parent c6035cf802
commit 6bd9b479b8
16 changed files with 97 additions and 87 deletions

View File

@ -136,11 +136,11 @@ AM_CONDITIONAL(HAVE_ICU, $have_icu)
dnl ========================================================================== dnl ==========================================================================
PKG_CHECK_MODULES(GRAPHITE, graphite2, have_graphite=true, have_graphite=false) PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
if $have_graphite; then if $have_graphite; then
AC_DEFINE(HAVE_GRAPHITE, 1, [Have Graphite library]) AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
fi fi
AM_CONDITIONAL(HAVE_GRAPHITE, $have_graphite) AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
dnl ========================================================================== dnl ==========================================================================

View File

@ -77,7 +77,6 @@ HBSOURCES += \
HBHEADERS += \ HBHEADERS += \
hb-ot.h \ hb-ot.h \
hb-ot-layout.h \ hb-ot-layout.h \
hb-ot-shape.h \
hb-ot-tag.h \ hb-ot-tag.h \
$(NULL) $(NULL)
endif endif
@ -118,17 +117,17 @@ HBSOURCES += hb-ft.cc
HBHEADERS += hb-ft.h HBHEADERS += hb-ft.h
endif endif
if HAVE_GRAPHITE if HAVE_GRAPHITE2
HBCFLAGS += $(GRAPHITE_CFLAGS) HBCFLAGS += $(GRAPHITE2_CFLAGS)
HBLIBS += $(GRAPHITE_LIBS) HBLIBS += $(GRAPHITE2_LIBS)
HBSOURCES += hb-graphite2.cc HBSOURCES += hb-graphite2.cc hb-graphite2-private.hh
HBHEADERS += hb-graphite2.h HBHEADERS += hb-graphite2.h
endif endif
if HAVE_UNISCRIBE if HAVE_UNISCRIBE
HBCFLAGS += $(UNISCRIBE_CFLAGS) HBCFLAGS += $(UNISCRIBE_CFLAGS)
HBLIBS += $(UNISCRIBE_LIBS) HBLIBS += $(UNISCRIBE_LIBS)
HBSOURCES += hb-uniscribe.cc HBSOURCES += hb-uniscribe.cc hb-uniscribe-private.hh
HBHEADERS += hb-uniscribe.h HBHEADERS += hb-uniscribe.h
endif endif

View File

@ -36,11 +36,10 @@ HB_BEGIN_DECLS
HB_INTERNAL hb_bool_t HB_INTERNAL hb_bool_t
hb_fallback_shape (hb_font_t *font, _hb_fallback_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features);
const char * const *shaper_options);
HB_END_DECLS HB_END_DECLS

View File

@ -29,11 +29,10 @@
#include "hb-buffer-private.hh" #include "hb-buffer-private.hh"
hb_bool_t hb_bool_t
hb_fallback_shape (hb_font_t *font, _hb_fallback_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features)
const char * const *shaper_options)
{ {
buffer->guess_properties (); buffer->guess_properties ();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright © 2010 Red Hat, Inc. * Copyright © 2012 Google, Inc.
* *
* This is part of HarfBuzz, a text shaping library. * This is part of HarfBuzz, a text shaping library.
* *
@ -21,28 +21,22 @@
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
* *
* Red Hat Author(s): Behdad Esfahbod * Google Author(s): Behdad Esfahbod
*/ */
#ifndef HB_OT_H_IN #ifndef HB_GRAPHITE2_PRIVATE_HH
#error "Include <hb-ot.h> instead." #define HB_GRAPHITE2_PRIVATE_HH
#endif
#ifndef HB_OT_SHAPE_H #include "hb-private.hh"
#define HB_OT_SHAPE_H
HB_BEGIN_DECLS #include "hb-graphite2.h"
#include "hb.h"
hb_bool_t HB_INTERNAL hb_bool_t
hb_ot_shape (hb_font_t *font, _hb_graphite2_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features);
const char * const *shaper_options);
HB_END_DECLS #endif /* HB_GRAPHITE2_PRIVATE_HH */
#endif /* HB_OT_SHAPE_H */

View File

@ -212,11 +212,10 @@ _hb_gr_font_get_data (hb_font_t *font)
hb_bool_t hb_bool_t
hb_graphite_shape (hb_font_t *font, _hb_graphite_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features)
const char * const *shaper_options)
{ {
buffer->guess_properties (); buffer->guess_properties ();

View File

@ -33,13 +33,6 @@ HB_BEGIN_DECLS
#define HB_GRAPHITE_TAG_Silf HB_TAG('S','i','l','f') #define HB_GRAPHITE_TAG_Silf HB_TAG('S','i','l','f')
hb_bool_t
hb_graphite_shape (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features,
const char * const *shaper_options);
/* TODO add gr_font/face etc getters and other glue API */ /* TODO add gr_font/face etc getters and other glue API */
HB_END_DECLS HB_END_DECLS

View File

@ -29,8 +29,6 @@
#include "hb-private.hh" #include "hb-private.hh"
#include "hb-ot-shape.h"
#include "hb-ot-map-private.hh" #include "hb-ot-map-private.hh"
#include "hb-ot-shape-complex-private.hh" #include "hb-ot-shape-complex-private.hh"
#include "hb-ot-shape-normalize-private.hh" #include "hb-ot-shape-normalize-private.hh"
@ -96,6 +94,12 @@ hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unic
HB_INTERNAL void _hb_set_unicode_props (hb_buffer_t *buffer); HB_INTERNAL void _hb_set_unicode_props (hb_buffer_t *buffer);
HB_INTERNAL hb_bool_t
_hb_ot_shape (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features);
#include "hb-ot-shape-complex-private.hh" #include "hb-ot-shape-complex-private.hh"
#endif /* HB_OT_SHAPE_PRIVATE_HH */ #endif /* HB_OT_SHAPE_PRIVATE_HH */

View File

@ -419,11 +419,10 @@ hb_ot_shape_execute (hb_ot_shape_plan_t *plan,
} }
hb_bool_t hb_bool_t
hb_ot_shape (hb_font_t *font, _hb_ot_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features)
const char * const *shaper_options)
{ {
hb_ot_shape_plan_t plan; hb_ot_shape_plan_t plan;
@ -434,5 +433,3 @@ hb_ot_shape (hb_font_t *font,
return TRUE; return TRUE;
} }

View File

@ -31,7 +31,6 @@
#include "hb.h" #include "hb.h"
#include "hb-ot-layout.h" #include "hb-ot-layout.h"
#include "hb-ot-shape.h"
#include "hb-ot-tag.h" #include "hb-ot-tag.h"
HB_BEGIN_DECLS HB_BEGIN_DECLS

View File

@ -31,30 +31,29 @@
#include "hb-buffer-private.hh" #include "hb-buffer-private.hh"
#ifdef HAVE_GRAPHITE #ifdef HAVE_GRAPHITE
#include "hb-graphite2.h" #include "hb-graphite2-private.hh"
#endif #endif
#ifdef HAVE_UNISCRIBE #ifdef HAVE_UNISCRIBE
# include "hb-uniscribe.h" # include "hb-uniscribe-private.hh"
#endif #endif
#ifdef HAVE_OT #ifdef HAVE_OT
# include "hb-ot-shape.h" # include "hb-ot-shape-private.hh"
#endif #endif
#include "hb-fallback-shape-private.hh" #include "hb-fallback-shape-private.hh"
typedef hb_bool_t (*hb_shape_func_t) (hb_font_t *font, typedef hb_bool_t (*hb_shape_func_t) (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features);
const char * const *shaper_options);
#define HB_SHAPER_IMPLEMENT(name) {#name, hb_##name##_shape} #define HB_SHAPER_IMPLEMENT(name) {#name, _hb_##name##_shape}
static struct hb_shaper_pair_t { static struct hb_shaper_pair_t {
char name[16]; char name[16];
hb_shape_func_t func; hb_shape_func_t func;
} shapers[] = { } shapers[] = {
/* v--- Add new shapers in the right place here */ /* v--- Add new shapers in the right place here */
#ifdef HAVE_GRAPHITE #ifdef HAVE_GRAPHITE
HB_SHAPER_IMPLEMENT (graphite), HB_SHAPER_IMPLEMENT (graphite2),
#endif #endif
#ifdef HAVE_UNISCRIBE #ifdef HAVE_UNISCRIBE
HB_SHAPER_IMPLEMENT (uniscribe), HB_SHAPER_IMPLEMENT (uniscribe),
@ -120,22 +119,17 @@ hb_shape_full (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features,
const char * const *shaper_options,
const char * const *shaper_list) const char * const *shaper_list)
{ {
if (likely (!shaper_list)) { if (likely (!shaper_list)) {
for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++) for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++)
if (likely (shapers[i].func (font, buffer, if (likely (shapers[i].func (font, buffer, features, num_features)))
features, num_features,
shaper_options)))
return TRUE; return TRUE;
} else { } else {
while (*shaper_list) { while (*shaper_list) {
for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++) for (unsigned int i = 0; i < ARRAY_LENGTH (shapers); i++)
if (0 == strcmp (*shaper_list, shapers[i].name)) { if (0 == strcmp (*shaper_list, shapers[i].name)) {
if (likely (shapers[i].func (font, buffer, if (likely (shapers[i].func (font, buffer, features, num_features)))
features, num_features,
shaper_options)))
return TRUE; return TRUE;
break; break;
} }
@ -151,5 +145,5 @@ hb_shape (hb_font_t *font,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features) unsigned int num_features)
{ {
hb_shape_full (font, buffer, features, num_features, NULL, NULL); hb_shape_full (font, buffer, features, num_features, NULL);
} }

View File

@ -57,7 +57,6 @@ hb_shape_full (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features,
const char * const *shaper_options,
const char * const *shaper_list); const char * const *shaper_list);
const char ** const char **

View File

@ -0,0 +1,42 @@
/*
* Copyright © 2012 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#ifndef HB_UNISCRIBE_PRIVATE_HH
#define HB_UNISCRIBE_PRIVATE_HH
#include "hb-private.hh"
#include "hb-uniscribe.h"
HB_INTERNAL hb_bool_t
_hb_uniscribe_shape (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features);
#endif /* HB_UNISCRIBE_PRIVATE_HH */

View File

@ -223,11 +223,10 @@ hb_uniscribe_font_get_hfont (hb_font_t *font)
hb_bool_t hb_bool_t
hb_uniscribe_shape (hb_font_t *font, _hb_uniscribe_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features)
const char * const *shaper_options)
{ {
buffer->guess_properties (); buffer->guess_properties ();

View File

@ -35,13 +35,6 @@
HB_BEGIN_DECLS HB_BEGIN_DECLS
hb_bool_t
hb_uniscribe_shape (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features,
const char * const *shaper_options);
LOGFONTW * LOGFONTW *
hb_uniscribe_font_get_logfontw (hb_font_t *font); hb_uniscribe_font_get_logfontw (hb_font_t *font);

View File

@ -166,7 +166,7 @@ struct shape_options_t : option_group_t
} }
setup_buffer (buffer); setup_buffer (buffer);
return hb_shape_full (font, buffer, features, num_features, NULL, shapers); return hb_shape_full (font, buffer, features, num_features, shapers);
} }
const char *direction; const char *direction;