зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1342964 - Update harfbuzz to version 1.4.3. r=jfkthame
This commit is contained in:
Родитель
deb1eaae99
Коммит
4c170cb836
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,9 +1,9 @@
|
|||
gfx/harfbuzz status as of 2017-01-25:
|
||||
gfx/harfbuzz status as of 2017-02-25:
|
||||
|
||||
This directory contains the harfbuzz source from the 'master' branch of
|
||||
https://github.com/behdad/harfbuzz.
|
||||
|
||||
Current version: 1.4.2
|
||||
Current version: 1.4.3
|
||||
|
||||
UPDATING:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
AC_PREREQ([2.64])
|
||||
AC_INIT([HarfBuzz],
|
||||
[1.4.2],
|
||||
[1.4.3],
|
||||
[https://github.com/behdad/harfbuzz/issues/new],
|
||||
[harfbuzz],
|
||||
[http://harfbuzz.org/])
|
||||
|
|
|
@ -218,7 +218,7 @@ harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
|
|||
(cat $^ || echo 'hb_ERROR ()' ) | \
|
||||
$(EGREP) '^hb_.* \(' | \
|
||||
sed -e 's/ (.*//' | \
|
||||
LANG=C sort; \
|
||||
LC_ALL=C sort; \
|
||||
echo LIBRARY libharfbuzz-0.dll; \
|
||||
) >"$@"
|
||||
@ ! grep -q hb_ERROR "$@" \
|
||||
|
|
|
@ -5,7 +5,7 @@ includedir=/usr/local/include
|
|||
|
||||
Name: harfbuzz
|
||||
Description: HarfBuzz text shaping library ICU integration
|
||||
Version: 1.4.2
|
||||
Version: 1.4.3
|
||||
|
||||
Requires: harfbuzz
|
||||
Requires.private: icu-uc
|
||||
|
|
|
@ -5,7 +5,7 @@ includedir=/usr/local/include
|
|||
|
||||
Name: harfbuzz
|
||||
Description: HarfBuzz text shaping library
|
||||
Version: 1.4.2
|
||||
Version: 1.4.3
|
||||
|
||||
Libs: -L${libdir} -lharfbuzz
|
||||
Libs.private:
|
||||
|
|
|
@ -69,8 +69,8 @@ hb_coretext_face_create (CGFontRef cg_font)
|
|||
}
|
||||
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(coretext, face)
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(coretext, font)
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1222,6 +1222,9 @@ fail:
|
|||
* AAT shaper
|
||||
*/
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, font)
|
||||
|
||||
/*
|
||||
* shaper face data
|
||||
*/
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
#define HB_DEBUG_DIRECTWRITE (HB_DEBUG+0)
|
||||
#endif
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(directwrite, face)
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(directwrite, font)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(directwrite, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(directwrite, font)
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -54,6 +54,13 @@ struct hb_face_t {
|
|||
mutable unsigned int upem; /* Units-per-EM. */
|
||||
mutable unsigned int num_glyphs; /* Number of glyphs. */
|
||||
|
||||
enum dirty_t {
|
||||
NOTHING = 0x0000,
|
||||
INDEX = 0x0001,
|
||||
UPEM = 0x0002,
|
||||
NUM_GLYPHS = 0x0004,
|
||||
} dirty;
|
||||
|
||||
struct hb_shaper_data_t shaper_data; /* Various shaper data. */
|
||||
|
||||
/* Various non-shaping data. */
|
||||
|
@ -99,6 +106,8 @@ struct hb_face_t {
|
|||
HB_INTERNAL void load_num_glyphs (void) const;
|
||||
};
|
||||
|
||||
HB_MARK_AS_FLAG_T (hb_face_t::dirty_t);
|
||||
|
||||
extern HB_INTERNAL const hb_face_t _hb_face_nil;
|
||||
|
||||
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
|
||||
|
|
|
@ -51,6 +51,8 @@ const hb_face_t _hb_face_nil = {
|
|||
1000, /* upem */
|
||||
0, /* num_glyphs */
|
||||
|
||||
hb_face_t::NOTHING, /* dirty */
|
||||
|
||||
{
|
||||
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
|
||||
#include "hb-shaper-list.hh"
|
||||
|
@ -171,7 +173,7 @@ hb_face_create (hb_blob_t *blob,
|
|||
closure,
|
||||
(hb_destroy_func_t) _hb_face_for_data_closure_destroy);
|
||||
|
||||
hb_face_set_index (face, index);
|
||||
face->index = index;
|
||||
|
||||
return face;
|
||||
}
|
||||
|
@ -365,6 +367,11 @@ hb_face_set_index (hb_face_t *face,
|
|||
if (face->immutable)
|
||||
return;
|
||||
|
||||
if (face->index == index)
|
||||
return;
|
||||
|
||||
face->dirty |= face->INDEX;
|
||||
|
||||
face->index = index;
|
||||
}
|
||||
|
||||
|
@ -400,6 +407,11 @@ hb_face_set_upem (hb_face_t *face,
|
|||
if (face->immutable)
|
||||
return;
|
||||
|
||||
if (face->upem == upem)
|
||||
return;
|
||||
|
||||
face->dirty |= face->UPEM;
|
||||
|
||||
face->upem = upem;
|
||||
}
|
||||
|
||||
|
@ -444,6 +456,11 @@ hb_face_set_glyph_count (hb_face_t *face,
|
|||
if (face->immutable)
|
||||
return;
|
||||
|
||||
if (face->num_glyphs == glyph_count)
|
||||
return;
|
||||
|
||||
face->dirty |= face->NUM_GLYPHS;
|
||||
|
||||
face->num_glyphs = glyph_count;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#include "hb-shaper-impl-private.hh"
|
||||
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(fallback, font)
|
||||
|
||||
|
||||
/*
|
||||
* shaper face data
|
||||
*/
|
||||
|
@ -125,7 +129,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
|
|||
pos[i].y_advance = 0;
|
||||
continue;
|
||||
}
|
||||
font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
|
||||
(void) font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
|
||||
font->get_glyph_advance_for_direction (info[i].codepoint,
|
||||
direction,
|
||||
&pos[i].x_advance,
|
||||
|
|
|
@ -116,6 +116,16 @@ struct hb_font_t {
|
|||
void *user_data;
|
||||
hb_destroy_func_t destroy;
|
||||
|
||||
enum dirty_t {
|
||||
NOTHING = 0x0000,
|
||||
FACE = 0x0001,
|
||||
PARENT = 0x0002,
|
||||
FUNCS = 0x0004,
|
||||
SCALE = 0x0008,
|
||||
PPEM = 0x0010,
|
||||
VARIATIONS = 0x0020,
|
||||
} dirty;
|
||||
|
||||
struct hb_shaper_data_t shaper_data;
|
||||
|
||||
|
||||
|
@ -543,6 +553,8 @@ struct hb_font_t {
|
|||
}
|
||||
};
|
||||
|
||||
HB_MARK_AS_FLAG_T (hb_font_t::dirty_t);
|
||||
|
||||
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
|
||||
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, font);
|
||||
#include "hb-shaper-list.hh"
|
||||
|
|
|
@ -1196,6 +1196,8 @@ hb_font_get_empty (void)
|
|||
NULL, /* user_data */
|
||||
NULL, /* destroy */
|
||||
|
||||
hb_font_t::NOTHING, /* dirty */
|
||||
|
||||
{
|
||||
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
|
||||
#include "hb-shaper-list.hh"
|
||||
|
@ -1348,6 +1350,11 @@ hb_font_set_parent (hb_font_t *font,
|
|||
if (!parent)
|
||||
parent = hb_font_get_empty ();
|
||||
|
||||
if (parent == font->parent)
|
||||
return;
|
||||
|
||||
font->dirty |= font->PARENT;
|
||||
|
||||
hb_font_t *old = font->parent;
|
||||
|
||||
font->parent = hb_font_reference (parent);
|
||||
|
@ -1371,6 +1378,37 @@ hb_font_get_parent (hb_font_t *font)
|
|||
return font->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_font_set_face:
|
||||
* @font: a font.
|
||||
* @face: new face.
|
||||
*
|
||||
* Sets font-face of @font.
|
||||
*
|
||||
* Since: 1.4.3
|
||||
**/
|
||||
void
|
||||
hb_font_set_face (hb_font_t *font,
|
||||
hb_face_t *face)
|
||||
{
|
||||
if (font->immutable)
|
||||
return;
|
||||
|
||||
if (unlikely (!face))
|
||||
face = hb_face_get_empty ();
|
||||
|
||||
if (font->face == face)
|
||||
return;
|
||||
|
||||
font->dirty |= font->FACE;
|
||||
|
||||
hb_face_t *old = font->face;
|
||||
|
||||
font->face = hb_face_reference (face);
|
||||
|
||||
hb_face_destroy (old);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_font_get_face:
|
||||
* @font: a font.
|
||||
|
@ -1417,6 +1455,8 @@ hb_font_set_funcs (hb_font_t *font,
|
|||
if (!klass)
|
||||
klass = hb_font_funcs_get_empty ();
|
||||
|
||||
font->dirty |= font->FUNCS;
|
||||
|
||||
hb_font_funcs_reference (klass);
|
||||
hb_font_funcs_destroy (font->klass);
|
||||
font->klass = klass;
|
||||
|
@ -1472,6 +1512,11 @@ hb_font_set_scale (hb_font_t *font,
|
|||
if (font->immutable)
|
||||
return;
|
||||
|
||||
if (font->x_scale == x_scale && font->y_scale == y_scale)
|
||||
return;
|
||||
|
||||
font->dirty |= font->SCALE;
|
||||
|
||||
font->x_scale = x_scale;
|
||||
font->y_scale = y_scale;
|
||||
}
|
||||
|
@ -1513,6 +1558,11 @@ hb_font_set_ppem (hb_font_t *font,
|
|||
if (font->immutable)
|
||||
return;
|
||||
|
||||
if (font->x_ppem == x_ppem && font->y_ppem == y_ppem)
|
||||
return;
|
||||
|
||||
font->dirty |= font->PPEM;
|
||||
|
||||
font->x_ppem = x_ppem;
|
||||
font->y_ppem = y_ppem;
|
||||
}
|
||||
|
@ -1545,6 +1595,16 @@ _hb_font_adopt_var_coords_normalized (hb_font_t *font,
|
|||
int *coords, /* 2.14 normalized */
|
||||
unsigned int coords_length)
|
||||
{
|
||||
if (font->num_coords == coords_length &&
|
||||
(coords_length == 0 ||
|
||||
0 == memcmp (font->coords, coords, coords_length * sizeof (coords[0]))))
|
||||
{
|
||||
free (coords);
|
||||
return;
|
||||
}
|
||||
|
||||
font->dirty |= font->VARIATIONS;
|
||||
|
||||
free (font->coords);
|
||||
|
||||
font->coords = coords;
|
||||
|
@ -1627,7 +1687,7 @@ hb_font_set_var_coords_normalized (hb_font_t *font,
|
|||
}
|
||||
|
||||
/**
|
||||
* hb_font_set_var_coords_normalized:
|
||||
* hb_font_get_var_coords_normalized:
|
||||
*
|
||||
* Return value is valid as long as variation coordinates of the font
|
||||
* are not modified.
|
||||
|
|
|
@ -563,6 +563,10 @@ hb_font_set_parent (hb_font_t *font,
|
|||
HB_EXTERN hb_font_t *
|
||||
hb_font_get_parent (hb_font_t *font);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_font_set_face (hb_font_t *font,
|
||||
hb_face_t *face);
|
||||
|
||||
HB_EXTERN hb_face_t *
|
||||
hb_font_get_face (hb_font_t *font);
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
|
||||
#define HB_SHAPER graphite2
|
||||
#define hb_graphite2_shaper_font_data_t gr_font
|
||||
#include "hb-shaper-impl-private.hh"
|
||||
|
||||
#include "hb-graphite2.h"
|
||||
|
@ -35,8 +34,8 @@
|
|||
#include <graphite2/Segment.h>
|
||||
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(graphite2, face)
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(graphite2, font)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font)
|
||||
|
||||
|
||||
/*
|
||||
|
@ -153,26 +152,17 @@ hb_graphite2_face_get_gr_face (hb_face_t *face)
|
|||
* shaper font data
|
||||
*/
|
||||
|
||||
static float hb_graphite2_get_advance (const void *hb_font, unsigned short gid)
|
||||
{
|
||||
return ((hb_font_t *) hb_font)->get_glyph_h_advance (gid);
|
||||
}
|
||||
struct hb_graphite2_shaper_font_data_t {};
|
||||
|
||||
hb_graphite2_shaper_font_data_t *
|
||||
_hb_graphite2_shaper_font_data_create (hb_font_t *font)
|
||||
_hb_graphite2_shaper_font_data_create (hb_font_t *font HB_UNUSED)
|
||||
{
|
||||
if (unlikely (!hb_graphite2_shaper_face_data_ensure (font->face))) return NULL;
|
||||
|
||||
hb_face_t *face = font->face;
|
||||
hb_graphite2_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
|
||||
|
||||
return gr_make_font_with_advance_fn (font->x_scale, font, &hb_graphite2_get_advance, face_data->grface);
|
||||
return (hb_graphite2_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
|
||||
}
|
||||
|
||||
void
|
||||
_hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *data)
|
||||
_hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *data HB_UNUSED)
|
||||
{
|
||||
gr_font_destroy (data);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -181,8 +171,7 @@ _hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *data)
|
|||
gr_font *
|
||||
hb_graphite2_font_get_gr_font (hb_font_t *font)
|
||||
{
|
||||
if (unlikely (!hb_graphite2_shaper_font_data_ensure (font))) return NULL;
|
||||
return HB_SHAPER_DATA_GET (font);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,7 +219,6 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
|||
{
|
||||
hb_face_t *face = font->face;
|
||||
gr_face *grface = HB_SHAPER_DATA_GET (face)->grface;
|
||||
gr_font *grfont = HB_SHAPER_DATA_GET (font);
|
||||
|
||||
const char *lang = hb_language_to_string (hb_buffer_get_language (buffer));
|
||||
const char *lang_end = lang ? strchr (lang, '-') : NULL;
|
||||
|
@ -262,7 +250,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
|||
hb_tag_t script_tag[2];
|
||||
hb_ot_tags_from_script (hb_buffer_get_script (buffer), &script_tag[0], &script_tag[1]);
|
||||
|
||||
seg = gr_make_seg (grfont, grface,
|
||||
seg = gr_make_seg (NULL, grface,
|
||||
script_tag[1] == HB_TAG_NONE ? script_tag[0] : script_tag[1],
|
||||
feats,
|
||||
gr_utf32, chars, buffer->len,
|
||||
|
@ -373,7 +361,10 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
|||
}
|
||||
buffer->len = glyph_count;
|
||||
|
||||
float yscale = font->y_scale / font->x_scale;
|
||||
unsigned int upem = hb_face_get_upem (face);
|
||||
float xscale = (float) font->x_scale / upem;
|
||||
float yscale = (float) font->y_scale / upem;
|
||||
yscale *= yscale / xscale;
|
||||
/* Positioning. */
|
||||
if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
|
||||
{
|
||||
|
@ -383,16 +374,16 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
|||
curradvx = 0;
|
||||
for (is = gr_seg_first_slot (seg); is; pPos++, ++info, is = gr_slot_next_in_segment (is))
|
||||
{
|
||||
pPos->x_offset = gr_slot_origin_X (is) - curradvx;
|
||||
pPos->x_offset = gr_slot_origin_X (is) * xscale - curradvx;
|
||||
pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy;
|
||||
if (info->cluster != currclus) {
|
||||
pPos->x_advance = info->var1.i32;
|
||||
pPos->x_advance = info->var1.i32 * xscale;
|
||||
curradvx += pPos->x_advance;
|
||||
currclus = info->cluster;
|
||||
} else
|
||||
pPos->x_advance = 0.;
|
||||
|
||||
pPos->y_advance = gr_slot_advance_Y (is, grface, grfont) * yscale;
|
||||
pPos->y_advance = gr_slot_advance_Y (is, grface, NULL) * yscale;
|
||||
curradvy += pPos->y_advance;
|
||||
}
|
||||
}
|
||||
|
@ -401,20 +392,20 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
|||
int currclus = -1;
|
||||
const hb_glyph_info_t *info = buffer->info;
|
||||
hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL);
|
||||
curradvx = gr_seg_advance_X(seg);
|
||||
curradvx = gr_seg_advance_X(seg) * xscale;
|
||||
for (is = gr_seg_first_slot (seg); is; pPos++, info++, is = gr_slot_next_in_segment (is))
|
||||
{
|
||||
if (info->cluster != currclus)
|
||||
{
|
||||
pPos->x_advance = info->var1.i32;
|
||||
if (currclus != -1) curradvx -= info[-1].var1.i32;
|
||||
pPos->x_advance = info->var1.i32 * xscale;
|
||||
if (currclus != -1) curradvx -= info[-1].var1.i32 * xscale;
|
||||
currclus = info->cluster;
|
||||
} else
|
||||
pPos->x_advance = 0.;
|
||||
|
||||
pPos->y_advance = gr_slot_advance_Y (is, grface, grfont) * yscale;
|
||||
pPos->y_advance = gr_slot_advance_Y (is, grface, NULL) * yscale;
|
||||
curradvy -= pPos->y_advance;
|
||||
pPos->x_offset = gr_slot_origin_X (is) - curradvx + pPos->x_advance;
|
||||
pPos->x_offset = gr_slot_origin_X (is) * xscale - curradvx + pPos->x_advance;
|
||||
pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy;
|
||||
}
|
||||
hb_buffer_reverse_clusters (buffer);
|
||||
|
|
|
@ -39,9 +39,13 @@ HB_BEGIN_DECLS
|
|||
HB_EXTERN gr_face *
|
||||
hb_graphite2_face_get_gr_face (hb_face_t *face);
|
||||
|
||||
#ifndef HB_DISABLE_DEPRECATED
|
||||
|
||||
HB_EXTERN gr_font *
|
||||
hb_graphite2_font_get_gr_font (hb_font_t *font);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
|
|
@ -623,5 +623,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
|
|||
#undef lig_props
|
||||
#undef glyph_props
|
||||
|
||||
|
||||
#endif /* HB_OT_LAYOUT_PRIVATE_HH */
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
#include "hb-ot-map-private.hh"
|
||||
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(ot, face)
|
||||
|
||||
hb_ot_layout_t *
|
||||
_hb_ot_layout_create (hb_face_t *face)
|
||||
{
|
||||
|
@ -135,6 +133,9 @@ _hb_ot_layout_create (hb_face_t *face)
|
|||
|| (1330 == gdef_len && 57938 == gpos_len && 109904 == gsub_len)
|
||||
/* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */
|
||||
|| (1330 == gdef_len && 58972 == gpos_len && 109904 == gsub_len)
|
||||
/* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf
|
||||
* "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */
|
||||
|| (1004 == gdef_len && 14836 == gpos_len && 59092 == gsub_len)
|
||||
)
|
||||
{
|
||||
/* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks
|
||||
|
|
|
@ -26,10 +26,9 @@
|
|||
|
||||
#include "hb-open-type-private.hh"
|
||||
|
||||
#include "hb-ot-layout-private.hh"
|
||||
#include "hb-ot-math-table.hh"
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(ot, face)
|
||||
|
||||
static inline const OT::MATH&
|
||||
_get_math (hb_face_t *face)
|
||||
{
|
||||
|
|
|
@ -540,7 +540,7 @@ apply_stch (const hb_ot_shape_plan_t *plan,
|
|||
/* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */
|
||||
hb_position_t extra_repeat_overlap = 0;
|
||||
hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
|
||||
if (shortfall > 0)
|
||||
if (shortfall > 0 && n_repeating > 0)
|
||||
{
|
||||
++n_copies;
|
||||
hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
|
||||
|
|
|
@ -422,6 +422,13 @@ hb_indic_get_categories (hb_codepoint_t u)
|
|||
if (hb_in_range (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
|
||||
break;
|
||||
|
||||
case 0x11u:
|
||||
// According to ScriptExtensions.txt, these Grantha marks may also be used in Tamil,
|
||||
// so the Indic shaper needs to know their categories.
|
||||
if (unlikely (u == 0x11303)) return _(Vs,R);
|
||||
if (unlikely (u == 0x1133c)) return _(N,B);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -191,6 +191,9 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
|
|||
case HB_SCRIPT_MANICHAEAN:
|
||||
case HB_SCRIPT_PSALTER_PAHLAVI:
|
||||
|
||||
/* Unicode-9.0 additions */
|
||||
case HB_SCRIPT_ADLAM:
|
||||
|
||||
/* For Arabic script, use the Arabic shaper even if no OT script tag was found.
|
||||
* This is because we do fallback shaping for Arabic script (and not others).
|
||||
* But note that Arabic shaping is applicable only to horizontal layout; for
|
||||
|
|
|
@ -91,7 +91,7 @@ compose_unicode (const hb_ot_shape_normalize_context_t *c,
|
|||
static inline void
|
||||
set_glyph (hb_glyph_info_t &info, hb_font_t *font)
|
||||
{
|
||||
font->get_nominal_glyph (info.codepoint, &info.glyph_index());
|
||||
(void) font->get_nominal_glyph (info.codepoint, &info.glyph_index());
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -128,6 +128,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
|||
* shaper face data
|
||||
*/
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(ot, face)
|
||||
|
||||
hb_ot_shaper_face_data_t *
|
||||
_hb_ot_shaper_face_data_create (hb_face_t *face)
|
||||
{
|
||||
|
@ -145,6 +147,8 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data)
|
|||
* shaper font data
|
||||
*/
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(ot, font)
|
||||
|
||||
struct hb_ot_shaper_font_data_t {};
|
||||
|
||||
hb_ot_shaper_font_data_t *
|
||||
|
|
|
@ -78,10 +78,10 @@ struct DeltaSetIndexMap
|
|||
{ return (format & 0xF) + 1; }
|
||||
|
||||
protected:
|
||||
USHORT format; /* A packed field that describes the compressed
|
||||
USHORT format; /* A packed field that describes the compressed
|
||||
* representation of delta-set indices. */
|
||||
USHORT mapCount; /* The number of mapping entries. */
|
||||
BYTE mapData[VAR]; /* The delta-set index mapping data. */
|
||||
USHORT mapCount; /* The number of mapping entries. */
|
||||
BYTE mapData[VAR]; /* The delta-set index mapping data. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (4, mapData);
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright © 2017 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_OT_VAR_MVAR_TABLE_HH
|
||||
#define HB_OT_VAR_MVAR_TABLE_HH
|
||||
|
||||
#include "hb-ot-layout-common-private.hh"
|
||||
|
||||
|
||||
namespace OT {
|
||||
|
||||
|
||||
struct VariationValueRecord
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
public:
|
||||
Tag valueTag; /* Four-byte tag identifying a font-wide measure. */
|
||||
ULONG varIdx; /* Outer/inner index into VariationStore item. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (8);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* MVAR -- Metrics Variations Table
|
||||
*/
|
||||
|
||||
#define HB_OT_TAG_MVAR HB_TAG('M','V','A','R')
|
||||
|
||||
struct MVAR
|
||||
{
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_MVAR;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (version.sanitize (c) &&
|
||||
likely (version.major == 1) &&
|
||||
c->check_struct (this) &&
|
||||
valueRecordSize >= VariationValueRecord::static_size &&
|
||||
varStore.sanitize (c, this) &&
|
||||
c->check_array (values, valueRecordSize, valueRecordCount));
|
||||
}
|
||||
|
||||
inline float get_var (hb_tag_t tag,
|
||||
int *coords, unsigned int coord_count) const
|
||||
{
|
||||
const VariationValueRecord *record;
|
||||
record = (VariationValueRecord *) bsearch (&tag, values,
|
||||
valueRecordCount, valueRecordSize,
|
||||
(hb_compare_func_t) tag_compare);
|
||||
if (!record)
|
||||
return 0.;
|
||||
|
||||
return (this+varStore).get_delta (record->varIdx, coords, coord_count);
|
||||
}
|
||||
|
||||
protected:
|
||||
static inline int tag_compare (const hb_tag_t *a, const Tag *b)
|
||||
{ return b->cmp (*a); }
|
||||
|
||||
protected:
|
||||
FixedVersion<>version; /* Version of the metrics variation table
|
||||
* initially set to 0x00010000u */
|
||||
USHORT reserved; /* Not used; set to 0. */
|
||||
USHORT valueRecordSize;/* The size in bytes of each value record —
|
||||
* must be greater than zero. */
|
||||
USHORT valueRecordCount;/* The number of value records — may be zero. */
|
||||
OffsetTo<VariationStore>
|
||||
varStore; /* Offset to item variation store table. */
|
||||
BYTE values[VAR]; /* Array of value records. The records must be
|
||||
* in binary order of their valueTag field. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (12, values);
|
||||
};
|
||||
|
||||
} /* namespace OT */
|
||||
|
||||
|
||||
#endif /* HB_OT_VAR_MVAR_TABLE_HH */
|
|
@ -29,10 +29,9 @@
|
|||
#include "hb-ot-layout-private.hh"
|
||||
#include "hb-ot-var-avar-table.hh"
|
||||
#include "hb-ot-var-fvar-table.hh"
|
||||
#include "hb-ot-var-mvar-table.hh"
|
||||
#include "hb-ot-var.h"
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(ot, face)
|
||||
|
||||
/*
|
||||
* fvar/avar
|
||||
*/
|
||||
|
|
|
@ -35,13 +35,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
#define HB_SHAPER_IMPLEMENT(shaper) \
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(shaper, face) \
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(shaper, font)
|
||||
#include "hb-shaper-list.hh"
|
||||
#undef HB_SHAPER_IMPLEMENT
|
||||
|
||||
|
||||
static void
|
||||
hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
|
||||
const hb_feature_t *user_features,
|
||||
|
|
|
@ -65,27 +65,31 @@ struct hb_shaper_data_t {
|
|||
#define HB_SHAPER_DATA_INVALID ((void *) -1)
|
||||
#define HB_SHAPER_DATA_IS_INVALID(data) ((void *) (data) == HB_SHAPER_DATA_INVALID)
|
||||
|
||||
#define HB_SHAPER_DATA_TYPE(shaper, object) struct hb_##shaper##_shaper_##object##_data_t
|
||||
#define HB_SHAPER_DATA_TYPE_NAME(shaper, object) hb_##shaper##_shaper_##object##_data_t
|
||||
#define HB_SHAPER_DATA_TYPE(shaper, object) struct HB_SHAPER_DATA_TYPE_NAME(shaper, object)
|
||||
#define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* (HB_SHAPER_DATA_TYPE(shaper, object) **) &(instance)->shaper_data.shaper)
|
||||
#define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE (shaper, object, object)
|
||||
#define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE(shaper, object, object)
|
||||
#define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_create
|
||||
#define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_destroy
|
||||
#define HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) hb_##shaper##_shaper_##object##_data_ensure
|
||||
|
||||
#define HB_SHAPER_DATA_PROTOTYPE(shaper, object) \
|
||||
HB_SHAPER_DATA_TYPE (shaper, object); /* Type forward declaration. */ \
|
||||
extern "C" HB_INTERNAL HB_SHAPER_DATA_TYPE (shaper, object) * \
|
||||
HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (hb_##object##_t *object HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS); \
|
||||
extern "C" HB_INTERNAL void \
|
||||
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data)
|
||||
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data); \
|
||||
extern "C" HB_INTERNAL bool \
|
||||
HB_SHAPER_DATA_ENSURE_FUNC (shaper, object) (hb_##object##_t *object)
|
||||
|
||||
#define HB_SHAPER_DATA_DESTROY(shaper, object) \
|
||||
if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \
|
||||
if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \
|
||||
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data);
|
||||
|
||||
#define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \
|
||||
static inline bool \
|
||||
hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \
|
||||
#define HB_SHAPER_DATA_ENSURE_DEFINE(shaper, object) \
|
||||
bool \
|
||||
HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
|
||||
{\
|
||||
retry: \
|
||||
HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \
|
||||
|
|
|
@ -293,8 +293,8 @@ struct range_record_t {
|
|||
unsigned int index_last; /* == end - 1 */
|
||||
};
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(uniscribe, face)
|
||||
HB_SHAPER_DATA_ENSURE_DECLARE(uniscribe, font)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(uniscribe, font)
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,9 +38,9 @@ HB_BEGIN_DECLS
|
|||
|
||||
#define HB_VERSION_MAJOR 1
|
||||
#define HB_VERSION_MINOR 4
|
||||
#define HB_VERSION_MICRO 2
|
||||
#define HB_VERSION_MICRO 3
|
||||
|
||||
#define HB_VERSION_STRING "1.4.2"
|
||||
#define HB_VERSION_STRING "1.4.3"
|
||||
|
||||
#define HB_VERSION_ATLEAST(major,minor,micro) \
|
||||
((major)*10000+(minor)*100+(micro) <= \
|
||||
|
|
|
@ -40,7 +40,6 @@ SOURCES += [
|
|||
UNIFIED_SOURCES += [
|
||||
'hb-buffer.cc',
|
||||
'hb-face.cc',
|
||||
'hb-fallback-shape.cc',
|
||||
'hb-font.cc',
|
||||
'hb-ot-layout.cc',
|
||||
'hb-ot-map.cc',
|
||||
|
|
Загрузка…
Ссылка в новой задаче