Use nullptr instead of NULL
This commit is contained in:
parent
fbb937b680
commit
dbdbfe3d7b
|
@ -72,8 +72,8 @@ _hb_blob_destroy_user_data (hb_blob_t *blob)
|
||||||
{
|
{
|
||||||
if (blob->destroy) {
|
if (blob->destroy) {
|
||||||
blob->destroy (blob->user_data);
|
blob->destroy (blob->user_data);
|
||||||
blob->user_data = NULL;
|
blob->user_data = nullptr;
|
||||||
blob->destroy = NULL;
|
blob->destroy = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,12 +194,12 @@ hb_blob_get_empty (void)
|
||||||
|
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
|
|
||||||
NULL, /* data */
|
nullptr, /* data */
|
||||||
0, /* length */
|
0, /* length */
|
||||||
HB_MEMORY_MODE_READONLY, /* mode */
|
HB_MEMORY_MODE_READONLY, /* mode */
|
||||||
|
|
||||||
NULL, /* user_data */
|
nullptr, /* user_data */
|
||||||
NULL /* destroy */
|
nullptr /* destroy */
|
||||||
};
|
};
|
||||||
|
|
||||||
return const_cast<hb_blob_t *> (&_hb_blob_nil);
|
return const_cast<hb_blob_t *> (&_hb_blob_nil);
|
||||||
|
@ -379,7 +379,7 @@ hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length)
|
||||||
if (length)
|
if (length)
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length)
|
if (length)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
static const char *serialize_formats[] = {
|
static const char *serialize_formats[] = {
|
||||||
"text",
|
"text",
|
||||||
"json",
|
"json",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,7 +90,7 @@ hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format)
|
||||||
case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return serialize_formats[0];
|
case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return serialize_formats[0];
|
||||||
case HB_BUFFER_SERIALIZE_FORMAT_JSON: return serialize_formats[1];
|
case HB_BUFFER_SERIALIZE_FORMAT_JSON: return serialize_formats[1];
|
||||||
default:
|
default:
|
||||||
case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return NULL;
|
case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_serialize_flags_t flags)
|
hb_buffer_serialize_flags_t flags)
|
||||||
{
|
{
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
|
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
|
||||||
hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
|
hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
|
||||||
NULL : hb_buffer_get_glyph_positions (buffer, NULL);
|
nullptr : hb_buffer_get_glyph_positions (buffer, nullptr);
|
||||||
|
|
||||||
*buf_consumed = 0;
|
*buf_consumed = 0;
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
|
@ -194,9 +194,9 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_serialize_flags_t flags)
|
hb_buffer_serialize_flags_t flags)
|
||||||
{
|
{
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
|
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
|
||||||
hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
|
hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
|
||||||
NULL : hb_buffer_get_glyph_positions (buffer, NULL);
|
nullptr : hb_buffer_get_glyph_positions (buffer, nullptr);
|
||||||
|
|
||||||
*buf_consumed = 0;
|
*buf_consumed = 0;
|
||||||
for (unsigned int i = start; i < end; i++)
|
for (unsigned int i = start; i < end; i++)
|
||||||
|
@ -422,8 +422,8 @@ hb_bool_t
|
||||||
hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
|
hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
int buf_len, /* -1 means nul-terminated */
|
int buf_len, /* -1 means nul-terminated */
|
||||||
const char **end_ptr, /* May be NULL */
|
const char **end_ptr, /* May be nullptr */
|
||||||
hb_font_t *font, /* May be NULL */
|
hb_font_t *font, /* May be nullptr */
|
||||||
hb_buffer_serialize_format_t format)
|
hb_buffer_serialize_format_t format)
|
||||||
{
|
{
|
||||||
const char *end;
|
const char *end;
|
||||||
|
|
|
@ -120,8 +120,8 @@ hb_buffer_t::enlarge (unsigned int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int new_allocated = allocated;
|
unsigned int new_allocated = allocated;
|
||||||
hb_glyph_position_t *new_pos = NULL;
|
hb_glyph_position_t *new_pos = nullptr;
|
||||||
hb_glyph_info_t *new_info = NULL;
|
hb_glyph_info_t *new_info = nullptr;
|
||||||
bool separate_out = out_info != info;
|
bool separate_out = out_info != info;
|
||||||
|
|
||||||
if (unlikely (_hb_unsigned_int_mul_overflows (size, sizeof (info[0]))))
|
if (unlikely (_hb_unsigned_int_mul_overflows (size, sizeof (info[0]))))
|
||||||
|
@ -1993,9 +1993,9 @@ hb_buffer_set_message_func (hb_buffer_t *buffer,
|
||||||
buffer->message_data = user_data;
|
buffer->message_data = user_data;
|
||||||
buffer->message_destroy = destroy;
|
buffer->message_destroy = destroy;
|
||||||
} else {
|
} else {
|
||||||
buffer->message_func = NULL;
|
buffer->message_func = nullptr;
|
||||||
buffer->message_data = NULL;
|
buffer->message_data = nullptr;
|
||||||
buffer->message_destroy = NULL;
|
buffer->message_destroy = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,13 +274,13 @@ retry:
|
||||||
/* Not found; allocate one. */
|
/* Not found; allocate one. */
|
||||||
hb_language_item_t *lang = (hb_language_item_t *) calloc (1, sizeof (hb_language_item_t));
|
hb_language_item_t *lang = (hb_language_item_t *) calloc (1, sizeof (hb_language_item_t));
|
||||||
if (unlikely (!lang))
|
if (unlikely (!lang))
|
||||||
return NULL;
|
return nullptr;
|
||||||
lang->next = first_lang;
|
lang->next = first_lang;
|
||||||
*lang = key;
|
*lang = key;
|
||||||
if (unlikely (!lang->lang))
|
if (unlikely (!lang->lang))
|
||||||
{
|
{
|
||||||
free (lang);
|
free (lang);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
|
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
|
||||||
|
@ -318,7 +318,7 @@ hb_language_from_string (const char *str, int len)
|
||||||
if (!str || !len || !*str)
|
if (!str || !len || !*str)
|
||||||
return HB_LANGUAGE_INVALID;
|
return HB_LANGUAGE_INVALID;
|
||||||
|
|
||||||
hb_language_item_t *item = NULL;
|
hb_language_item_t *item = nullptr;
|
||||||
if (len >= 0)
|
if (len >= 0)
|
||||||
{
|
{
|
||||||
/* NUL-terminate it. */
|
/* NUL-terminate it. */
|
||||||
|
@ -349,7 +349,7 @@ hb_language_from_string (const char *str, int len)
|
||||||
const char *
|
const char *
|
||||||
hb_language_to_string (hb_language_t language)
|
hb_language_to_string (hb_language_t language)
|
||||||
{
|
{
|
||||||
/* This is actually NULL-safe! */
|
/* This is actually nullptr-safe! */
|
||||||
return language->s;
|
return language->s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ hb_language_get_default (void)
|
||||||
|
|
||||||
hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
|
hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
|
||||||
if (unlikely (language == HB_LANGUAGE_INVALID)) {
|
if (unlikely (language == HB_LANGUAGE_INVALID)) {
|
||||||
language = hb_language_from_string (setlocale (LC_CTYPE, NULL), -1);
|
language = hb_language_from_string (setlocale (LC_CTYPE, nullptr), -1);
|
||||||
(void) hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
|
(void) hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,9 +562,9 @@ hb_user_data_array_t::set (hb_user_data_key_t *key,
|
||||||
void *
|
void *
|
||||||
hb_user_data_array_t::get (hb_user_data_key_t *key)
|
hb_user_data_array_t::get (hb_user_data_key_t *key)
|
||||||
{
|
{
|
||||||
hb_user_data_item_t item = {NULL, NULL, NULL};
|
hb_user_data_item_t item = {nullptr, nullptr, nullptr};
|
||||||
|
|
||||||
return items.find (key, &item, lock) ? item.data : NULL;
|
return items.find (key, &item, lock) ? item.data : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -722,9 +722,9 @@ retry:
|
||||||
|
|
||||||
if (unlikely (!C))
|
if (unlikely (!C))
|
||||||
{
|
{
|
||||||
C = newlocale (LC_ALL_MASK, "C", NULL);
|
C = newlocale (LC_ALL_MASK, "C", nullptr);
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&C_locale, NULL, C))
|
if (!hb_atomic_ptr_cmpexch (&C_locale, nullptr, C))
|
||||||
{
|
{
|
||||||
freelocale (C_locale);
|
freelocale (C_locale);
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
|
@ -65,12 +65,12 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
|
||||||
CGFontRef cg_font = reinterpret_cast<CGFontRef> (user_data);
|
CGFontRef cg_font = reinterpret_cast<CGFontRef> (user_data);
|
||||||
CFDataRef cf_data = CGFontCopyTableForTag (cg_font, tag);
|
CFDataRef cf_data = CGFontCopyTableForTag (cg_font, tag);
|
||||||
if (unlikely (!cf_data))
|
if (unlikely (!cf_data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
const char *data = reinterpret_cast<const char*> (CFDataGetBytePtr (cf_data));
|
const char *data = reinterpret_cast<const char*> (CFDataGetBytePtr (cf_data));
|
||||||
const size_t length = CFDataGetLength (cf_data);
|
const size_t length = CFDataGetLength (cf_data);
|
||||||
if (!data || !length)
|
if (!data || !length)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return hb_blob_create (data, length, HB_MEMORY_MODE_READONLY,
|
return hb_blob_create (data, length, HB_MEMORY_MODE_READONLY,
|
||||||
reinterpret_cast<void *> (const_cast<__CFData *> (cf_data)),
|
reinterpret_cast<void *> (const_cast<__CFData *> (cf_data)),
|
||||||
|
@ -125,7 +125,7 @@ static void
|
||||||
release_data (void *info, const void *data, size_t size)
|
release_data (void *info, const void *data, size_t size)
|
||||||
{
|
{
|
||||||
assert (hb_blob_get_length ((hb_blob_t *) info) == size &&
|
assert (hb_blob_get_length ((hb_blob_t *) info) == size &&
|
||||||
hb_blob_get_data ((hb_blob_t *) info, NULL) == data);
|
hb_blob_get_data ((hb_blob_t *) info, nullptr) == data);
|
||||||
|
|
||||||
hb_blob_destroy ((hb_blob_t *) info);
|
hb_blob_destroy ((hb_blob_t *) info);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ release_data (void *info, const void *data, size_t size)
|
||||||
static CGFontRef
|
static CGFontRef
|
||||||
create_cg_font (hb_face_t *face)
|
create_cg_font (hb_face_t *face)
|
||||||
{
|
{
|
||||||
CGFontRef cg_font = NULL;
|
CGFontRef cg_font = nullptr;
|
||||||
if (face->destroy == _hb_cg_font_release)
|
if (face->destroy == _hb_cg_font_release)
|
||||||
{
|
{
|
||||||
cg_font = CGFontRetain ((CGFontRef) face->user_data);
|
cg_font = CGFontRetain ((CGFontRef) face->user_data);
|
||||||
|
@ -161,7 +161,7 @@ create_cg_font (hb_face_t *face)
|
||||||
static CTFontRef
|
static CTFontRef
|
||||||
create_ct_font (CGFontRef cg_font, CGFloat font_size)
|
create_ct_font (CGFontRef cg_font, CGFloat font_size)
|
||||||
{
|
{
|
||||||
CTFontRef ct_font = NULL;
|
CTFontRef ct_font = nullptr;
|
||||||
|
|
||||||
/* CoreText does not enable trak table usage / tracking when creating a CTFont
|
/* CoreText does not enable trak table usage / tracking when creating a CTFont
|
||||||
* using CTFontCreateWithGraphicsFont. The only way of enabling tracking seems
|
* using CTFontCreateWithGraphicsFont. The only way of enabling tracking seems
|
||||||
|
@ -174,23 +174,23 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
|
||||||
if (CFStringHasSuffix (cg_postscript_name, CFSTR ("-Bold")))
|
if (CFStringHasSuffix (cg_postscript_name, CFSTR ("-Bold")))
|
||||||
font_type = kCTFontUIFontEmphasizedSystem;
|
font_type = kCTFontUIFontEmphasizedSystem;
|
||||||
|
|
||||||
ct_font = CTFontCreateUIFontForLanguage (font_type, font_size, NULL);
|
ct_font = CTFontCreateUIFontForLanguage (font_type, font_size, nullptr);
|
||||||
CFStringRef ct_result_name = CTFontCopyPostScriptName(ct_font);
|
CFStringRef ct_result_name = CTFontCopyPostScriptName(ct_font);
|
||||||
if (CFStringCompare (ct_result_name, cg_postscript_name, 0) != kCFCompareEqualTo)
|
if (CFStringCompare (ct_result_name, cg_postscript_name, 0) != kCFCompareEqualTo)
|
||||||
{
|
{
|
||||||
CFRelease(ct_font);
|
CFRelease(ct_font);
|
||||||
ct_font = NULL;
|
ct_font = nullptr;
|
||||||
}
|
}
|
||||||
CFRelease (ct_result_name);
|
CFRelease (ct_result_name);
|
||||||
}
|
}
|
||||||
CFRelease (cg_postscript_name);
|
CFRelease (cg_postscript_name);
|
||||||
|
|
||||||
if (!ct_font)
|
if (!ct_font)
|
||||||
ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
|
ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, nullptr, nullptr);
|
||||||
|
|
||||||
if (unlikely (!ct_font)) {
|
if (unlikely (!ct_font)) {
|
||||||
DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
|
DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* crbug.com/576941 and crbug.com/625902 and the investigation in the latter
|
/* crbug.com/576941 and crbug.com/625902 and the investigation in the latter
|
||||||
|
@ -200,7 +200,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
|
||||||
* reconfiguring the cascade list causes CoreText crashes. For details, see
|
* reconfiguring the cascade list causes CoreText crashes. For details, see
|
||||||
* crbug.com/549610 */
|
* crbug.com/549610 */
|
||||||
// 0x00070000 stands for "kCTVersionNumber10_10", see CoreText.h
|
// 0x00070000 stands for "kCTVersionNumber10_10", see CoreText.h
|
||||||
if (&CTGetCoreTextVersion != NULL && CTGetCoreTextVersion() < 0x00070000) {
|
if (&CTGetCoreTextVersion != nullptr && CTGetCoreTextVersion() < 0x00070000) {
|
||||||
CFStringRef fontName = CTFontCopyPostScriptName (ct_font);
|
CFStringRef fontName = CTFontCopyPostScriptName (ct_font);
|
||||||
bool isEmojiFont = CFStringCompare (fontName, CFSTR("AppleColorEmoji"), 0) == kCFCompareEqualTo;
|
bool isEmojiFont = CFStringCompare (fontName, CFSTR("AppleColorEmoji"), 0) == kCFCompareEqualTo;
|
||||||
CFRelease (fontName);
|
CFRelease (fontName);
|
||||||
|
@ -214,7 +214,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
|
||||||
* font fallback which we don't need anyway. */
|
* font fallback which we don't need anyway. */
|
||||||
{
|
{
|
||||||
CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc ();
|
CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc ();
|
||||||
CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc);
|
CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, nullptr, last_resort_font_desc);
|
||||||
CFRelease (last_resort_font_desc);
|
CFRelease (last_resort_font_desc);
|
||||||
if (new_ct_font)
|
if (new_ct_font)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +257,7 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face)
|
||||||
if (unlikely (!cg_font))
|
if (unlikely (!cg_font))
|
||||||
{
|
{
|
||||||
DEBUG_MSG (CORETEXT, face, "CGFont creation failed..");
|
DEBUG_MSG (CORETEXT, face, "CGFont creation failed..");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (hb_coretext_shaper_face_data_t *) cg_font;
|
return (hb_coretext_shaper_face_data_t *) cg_font;
|
||||||
|
@ -275,7 +275,7 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
|
||||||
CGFontRef
|
CGFontRef
|
||||||
hb_coretext_face_get_cg_font (hb_face_t *face)
|
hb_coretext_face_get_cg_font (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
|
if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr;
|
||||||
return (CGFontRef) HB_SHAPER_DATA_GET (face);
|
return (CGFontRef) HB_SHAPER_DATA_GET (face);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ hb_coretext_shaper_font_data_t *
|
||||||
_hb_coretext_shaper_font_data_create (hb_font_t *font)
|
_hb_coretext_shaper_font_data_create (hb_font_t *font)
|
||||||
{
|
{
|
||||||
hb_face_t *face = font->face;
|
hb_face_t *face = font->face;
|
||||||
if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
|
if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr;
|
||||||
CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face);
|
CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face);
|
||||||
|
|
||||||
CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size (font->ptem));
|
CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size (font->ptem));
|
||||||
|
@ -296,7 +296,7 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font)
|
||||||
if (unlikely (!ct_font))
|
if (unlikely (!ct_font))
|
||||||
{
|
{
|
||||||
DEBUG_MSG (CORETEXT, font, "CGFont creation failed..");
|
DEBUG_MSG (CORETEXT, font, "CGFont creation failed..");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (hb_coretext_shaper_font_data_t *) ct_font;
|
return (hb_coretext_shaper_font_data_t *) ct_font;
|
||||||
|
@ -333,7 +333,7 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_
|
||||||
CTFontRef
|
CTFontRef
|
||||||
hb_coretext_font_get_ct_font (hb_font_t *font)
|
hb_coretext_font_get_ct_font (hb_font_t *font)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL;
|
if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
|
||||||
return (CTFontRef)HB_SHAPER_DATA_GET (font);
|
return (CTFontRef)HB_SHAPER_DATA_GET (font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,12 +704,12 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
|
||||||
CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
|
CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
|
||||||
CFRelease (attributes);
|
CFRelease (attributes);
|
||||||
|
|
||||||
range->font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, font_desc);
|
range->font = CTFontCreateCopyWithAttributes (ct_font, 0.0, nullptr, font_desc);
|
||||||
CFRelease (font_desc);
|
CFRelease (font_desc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
range->font = NULL;
|
range->font = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
range->index_first = last_index;
|
range->index_first = last_index;
|
||||||
|
@ -779,14 +779,14 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
|
||||||
|
|
||||||
#define FAIL(...) \
|
#define FAIL(...) \
|
||||||
HB_STMT_START { \
|
HB_STMT_START { \
|
||||||
DEBUG_MSG (CORETEXT, NULL, __VA_ARGS__); \
|
DEBUG_MSG (CORETEXT, nullptr, __VA_ARGS__); \
|
||||||
ret = false; \
|
ret = false; \
|
||||||
goto fail; \
|
goto fail; \
|
||||||
} HB_STMT_END;
|
} HB_STMT_END;
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
CFStringRef string_ref = NULL;
|
CFStringRef string_ref = nullptr;
|
||||||
CTLineRef line = NULL;
|
CTLineRef line = nullptr;
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
|
@ -798,8 +798,8 @@ resize_and_retry:
|
||||||
assert (line);
|
assert (line);
|
||||||
CFRelease (string_ref);
|
CFRelease (string_ref);
|
||||||
CFRelease (line);
|
CFRelease (line);
|
||||||
string_ref = NULL;
|
string_ref = nullptr;
|
||||||
line = NULL;
|
line = nullptr;
|
||||||
|
|
||||||
/* Get previous start-of-scratch-area, that we use later for readjusting
|
/* Get previous start-of-scratch-area, that we use later for readjusting
|
||||||
* our existing scratch arrays. */
|
* our existing scratch arrays. */
|
||||||
|
@ -820,7 +820,7 @@ resize_and_retry:
|
||||||
scratch_size -= old_scratch_used;
|
scratch_size -= old_scratch_used;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
string_ref = CFStringCreateWithCharactersNoCopy (NULL,
|
string_ref = CFStringCreateWithCharactersNoCopy (nullptr,
|
||||||
pchars, chars_len,
|
pchars, chars_len,
|
||||||
kCFAllocatorNull);
|
kCFAllocatorNull);
|
||||||
if (unlikely (!string_ref))
|
if (unlikely (!string_ref))
|
||||||
|
@ -937,7 +937,7 @@ resize_and_retry:
|
||||||
|
|
||||||
CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
|
CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
|
||||||
unsigned int num_runs = CFArrayGetCount (glyph_runs);
|
unsigned int num_runs = CFArrayGetCount (glyph_runs);
|
||||||
DEBUG_MSG (CORETEXT, NULL, "Num runs: %d", num_runs);
|
DEBUG_MSG (CORETEXT, nullptr, "Num runs: %d", num_runs);
|
||||||
|
|
||||||
buffer->len = 0;
|
buffer->len = 0;
|
||||||
uint32_t status_and = ~0, status_or = 0;
|
uint32_t status_and = ~0, status_or = 0;
|
||||||
|
@ -963,7 +963,7 @@ resize_and_retry:
|
||||||
status_or |= run_status;
|
status_or |= run_status;
|
||||||
status_and &= run_status;
|
status_and &= run_status;
|
||||||
DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status);
|
DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status);
|
||||||
double run_advance = CTRunGetTypographicBounds (run, range_all, NULL, NULL, NULL);
|
double run_advance = CTRunGetTypographicBounds (run, range_all, nullptr, nullptr, nullptr);
|
||||||
if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction))
|
if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction))
|
||||||
run_advance = -run_advance;
|
run_advance = -run_advance;
|
||||||
DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);
|
DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);
|
||||||
|
@ -1089,7 +1089,7 @@ resize_and_retry:
|
||||||
|
|
||||||
/* Testing used to indicate that CTRunGetGlyphsPtr, etc (almost?) always
|
/* Testing used to indicate that CTRunGetGlyphsPtr, etc (almost?) always
|
||||||
* succeed, and so copying data to our own buffer will be rare. Reports
|
* succeed, and so copying data to our own buffer will be rare. Reports
|
||||||
* have it that this changed in OS X 10.10 Yosemite, and NULL is returned
|
* have it that this changed in OS X 10.10 Yosemite, and nullptr is returned
|
||||||
* frequently. At any rate, we can test that codepath by setting USE_PTR
|
* frequently. At any rate, we can test that codepath by setting USE_PTR
|
||||||
* to false. */
|
* to false. */
|
||||||
|
|
||||||
|
@ -1105,13 +1105,13 @@ resize_and_retry:
|
||||||
|
|
||||||
{ /* Setup glyphs */
|
{ /* Setup glyphs */
|
||||||
SCRATCH_SAVE();
|
SCRATCH_SAVE();
|
||||||
const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : NULL;
|
const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : nullptr;
|
||||||
if (!glyphs) {
|
if (!glyphs) {
|
||||||
ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry);
|
ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry);
|
||||||
CTRunGetGlyphs (run, range_all, glyph_buf);
|
CTRunGetGlyphs (run, range_all, glyph_buf);
|
||||||
glyphs = glyph_buf;
|
glyphs = glyph_buf;
|
||||||
}
|
}
|
||||||
const CFIndex* string_indices = USE_PTR ? CTRunGetStringIndicesPtr (run) : NULL;
|
const CFIndex* string_indices = USE_PTR ? CTRunGetStringIndicesPtr (run) : nullptr;
|
||||||
if (!string_indices) {
|
if (!string_indices) {
|
||||||
ALLOCATE_ARRAY (CFIndex, index_buf, num_glyphs, goto resize_and_retry);
|
ALLOCATE_ARRAY (CFIndex, index_buf, num_glyphs, goto resize_and_retry);
|
||||||
CTRunGetStringIndices (run, range_all, index_buf);
|
CTRunGetStringIndices (run, range_all, index_buf);
|
||||||
|
@ -1133,7 +1133,7 @@ resize_and_retry:
|
||||||
* advance (in the advance direction only), and for last glyph we set
|
* advance (in the advance direction only), and for last glyph we set
|
||||||
* whatever is needed to make the whole run's advance add up. */
|
* whatever is needed to make the whole run's advance add up. */
|
||||||
SCRATCH_SAVE();
|
SCRATCH_SAVE();
|
||||||
const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : NULL;
|
const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : nullptr;
|
||||||
if (!positions) {
|
if (!positions) {
|
||||||
ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry);
|
ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry);
|
||||||
CTRunGetPositions (run, range_all, position_buf);
|
CTRunGetPositions (run, range_all, position_buf);
|
||||||
|
@ -1300,12 +1300,12 @@ _hb_coretext_aat_shaper_face_data_create (hb_face_t *face)
|
||||||
if (hb_blob_get_length (blob))
|
if (hb_blob_get_length (blob))
|
||||||
{
|
{
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL;
|
return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr;
|
||||||
}
|
}
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1323,7 +1323,7 @@ struct hb_coretext_aat_shaper_font_data_t {};
|
||||||
hb_coretext_aat_shaper_font_data_t *
|
hb_coretext_aat_shaper_font_data_t *
|
||||||
_hb_coretext_aat_shaper_font_data_create (hb_font_t *font)
|
_hb_coretext_aat_shaper_font_data_create (hb_font_t *font)
|
||||||
{
|
{
|
||||||
return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL;
|
return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -140,7 +140,7 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
|
||||||
hb_directwrite_shaper_face_data_t *data =
|
hb_directwrite_shaper_face_data_t *data =
|
||||||
(hb_directwrite_shaper_face_data_t *) malloc (sizeof (hb_directwrite_shaper_face_data_t));
|
(hb_directwrite_shaper_face_data_t *) malloc (sizeof (hb_directwrite_shaper_face_data_t));
|
||||||
if (unlikely (!data))
|
if (unlikely (!data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
// TODO: factory and fontFileLoader should be cached separately
|
// TODO: factory and fontFileLoader should be cached separately
|
||||||
IDWriteFactory* dwriteFactory;
|
IDWriteFactory* dwriteFactory;
|
||||||
|
@ -153,7 +153,7 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
hb_blob_t *blob = hb_face_reference_blob (face);
|
hb_blob_t *blob = hb_face_reference_blob (face);
|
||||||
IDWriteFontFileStream *fontFileStream = new DWriteFontFileStream (
|
IDWriteFontFileStream *fontFileStream = new DWriteFontFileStream (
|
||||||
(uint8_t*) hb_blob_get_data (blob, NULL), hb_blob_get_length (blob));
|
(uint8_t*) hb_blob_get_data (blob, nullptr), hb_blob_get_length (blob));
|
||||||
|
|
||||||
IDWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream);
|
IDWriteFontFileLoader *fontFileLoader = new DWriteFontFileLoader (fontFileStream);
|
||||||
dwriteFactory->RegisterFontFileLoader (fontFileLoader);
|
dwriteFactory->RegisterFontFileLoader (fontFileLoader);
|
||||||
|
@ -165,7 +165,7 @@ _hb_directwrite_shaper_face_data_create(hb_face_t *face)
|
||||||
|
|
||||||
#define FAIL(...) \
|
#define FAIL(...) \
|
||||||
HB_STMT_START { \
|
HB_STMT_START { \
|
||||||
DEBUG_MSG (DIRECTWRITE, NULL, __VA_ARGS__); \
|
DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
|
||||||
return false; \
|
return false; \
|
||||||
} HB_STMT_END;
|
} HB_STMT_END;
|
||||||
|
|
||||||
|
@ -233,12 +233,12 @@ struct hb_directwrite_shaper_font_data_t {
|
||||||
hb_directwrite_shaper_font_data_t *
|
hb_directwrite_shaper_font_data_t *
|
||||||
_hb_directwrite_shaper_font_data_create (hb_font_t *font)
|
_hb_directwrite_shaper_font_data_create (hb_font_t *font)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_directwrite_shaper_face_data_ensure (font->face))) return NULL;
|
if (unlikely (!hb_directwrite_shaper_face_data_ensure (font->face))) return nullptr;
|
||||||
|
|
||||||
hb_directwrite_shaper_font_data_t *data =
|
hb_directwrite_shaper_font_data_t *data =
|
||||||
(hb_directwrite_shaper_font_data_t *) malloc (sizeof (hb_directwrite_shaper_font_data_t));
|
(hb_directwrite_shaper_font_data_t *) malloc (sizeof (hb_directwrite_shaper_font_data_t));
|
||||||
if (unlikely (!data))
|
if (unlikely (!data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ public:
|
||||||
, mTextLength(textLength)
|
, mTextLength(textLength)
|
||||||
, mLocaleName(localeName)
|
, mLocaleName(localeName)
|
||||||
, mReadingDirection(readingDirection)
|
, mReadingDirection(readingDirection)
|
||||||
, mCurrentRun(NULL) { };
|
, mCurrentRun(nullptr) { };
|
||||||
|
|
||||||
~TextAnalysis() {
|
~TextAnalysis() {
|
||||||
// delete runs, except mRunHead which is part of the TextAnalysis object
|
// delete runs, except mRunHead which is part of the TextAnalysis object
|
||||||
|
@ -337,7 +337,7 @@ public:
|
||||||
mRunHead.mTextLength = mTextLength;
|
mRunHead.mTextLength = mTextLength;
|
||||||
mRunHead.mBidiLevel =
|
mRunHead.mBidiLevel =
|
||||||
(mReadingDirection == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT);
|
(mReadingDirection == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT);
|
||||||
mRunHead.nextRun = NULL;
|
mRunHead.nextRun = nullptr;
|
||||||
mCurrentRun = &mRunHead;
|
mCurrentRun = &mRunHead;
|
||||||
|
|
||||||
// Call each of the analyzers in sequence, recording their results.
|
// Call each of the analyzers in sequence, recording their results.
|
||||||
|
@ -356,7 +356,7 @@ public:
|
||||||
{
|
{
|
||||||
if (textPosition >= mTextLength) {
|
if (textPosition >= mTextLength) {
|
||||||
// No text at this position, valid query though.
|
// No text at this position, valid query though.
|
||||||
*textString = NULL;
|
*textString = nullptr;
|
||||||
*textLength = 0;
|
*textLength = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -373,7 +373,7 @@ public:
|
||||||
if (textPosition == 0 || textPosition > mTextLength) {
|
if (textPosition == 0 || textPosition > mTextLength) {
|
||||||
// Either there is no text before here (== 0), or this
|
// Either there is no text before here (== 0), or this
|
||||||
// is an invalid position. The query is considered valid thouh.
|
// is an invalid position. The query is considered valid thouh.
|
||||||
*textString = NULL;
|
*textString = nullptr;
|
||||||
*textLength = 0;
|
*textLength = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -399,7 +399,7 @@ public:
|
||||||
OUT IDWriteNumberSubstitution** numberSubstitution)
|
OUT IDWriteNumberSubstitution** numberSubstitution)
|
||||||
{
|
{
|
||||||
// We do not support number substitution.
|
// We do not support number substitution.
|
||||||
*numberSubstitution = NULL;
|
*numberSubstitution = nullptr;
|
||||||
*textLength = mTextLength - textPosition;
|
*textLength = mTextLength - textPosition;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -617,14 +617,14 @@ _hb_directwrite_shape_full(hb_shape_plan_t *shape_plan,
|
||||||
*/
|
*/
|
||||||
uint32_t textLength = buffer->len;
|
uint32_t textLength = buffer->len;
|
||||||
|
|
||||||
TextAnalysis analysis(textString, textLength, NULL, readingDirection);
|
TextAnalysis analysis(textString, textLength, nullptr, readingDirection);
|
||||||
TextAnalysis::Run *runHead;
|
TextAnalysis::Run *runHead;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
hr = analysis.GenerateResults(analyzer, &runHead);
|
hr = analysis.GenerateResults(analyzer, &runHead);
|
||||||
|
|
||||||
#define FAIL(...) \
|
#define FAIL(...) \
|
||||||
HB_STMT_START { \
|
HB_STMT_START { \
|
||||||
DEBUG_MSG (DIRECTWRITE, NULL, __VA_ARGS__); \
|
DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
|
||||||
return false; \
|
return false; \
|
||||||
} HB_STMT_END;
|
} HB_STMT_END;
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ _hb_directwrite_shape_full(hb_shape_plan_t *shape_plan,
|
||||||
bool isRightToLeft = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
|
bool isRightToLeft = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
|
||||||
|
|
||||||
const wchar_t localeName[20] = {0};
|
const wchar_t localeName[20] = {0};
|
||||||
if (buffer->props.language != NULL)
|
if (buffer->props.language != nullptr)
|
||||||
{
|
{
|
||||||
mbstowcs ((wchar_t*) localeName,
|
mbstowcs ((wchar_t*) localeName,
|
||||||
hb_language_to_string (buffer->props.language), 20);
|
hb_language_to_string (buffer->props.language), 20);
|
||||||
|
@ -672,7 +672,7 @@ retry_getglyphs:
|
||||||
malloc (maxGlyphCount * sizeof (DWRITE_SHAPING_GLYPH_PROPERTIES));
|
malloc (maxGlyphCount * sizeof (DWRITE_SHAPING_GLYPH_PROPERTIES));
|
||||||
|
|
||||||
hr = analyzer->GetGlyphs (textString, textLength, fontFace, false,
|
hr = analyzer->GetGlyphs (textString, textLength, fontFace, false,
|
||||||
isRightToLeft, &runHead->mScript, localeName, NULL, &dwFeatures,
|
isRightToLeft, &runHead->mScript, localeName, nullptr, &dwFeatures,
|
||||||
featureRangeLengths, 1, maxGlyphCount, clusterMap, textProperties, glyphIndices,
|
featureRangeLengths, 1, maxGlyphCount, clusterMap, textProperties, glyphIndices,
|
||||||
glyphProperties, &glyphCount);
|
glyphProperties, &glyphCount);
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ const hb_face_t _hb_face_nil = {
|
||||||
|
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
|
|
||||||
NULL, /* reference_table_func */
|
nullptr, /* reference_table_func */
|
||||||
NULL, /* user_data */
|
nullptr, /* user_data */
|
||||||
NULL, /* destroy */
|
nullptr, /* destroy */
|
||||||
|
|
||||||
0, /* index */
|
0, /* index */
|
||||||
1000, /* upem */
|
1000, /* upem */
|
||||||
|
@ -57,7 +57,7 @@ const hb_face_t _hb_face_nil = {
|
||||||
#undef HB_SHAPER_IMPLEMENT
|
#undef HB_SHAPER_IMPLEMENT
|
||||||
},
|
},
|
||||||
|
|
||||||
NULL, /* shape_plans */
|
nullptr, /* shape_plans */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index)
|
||||||
|
|
||||||
closure = (hb_face_for_data_closure_t *) calloc (1, sizeof (hb_face_for_data_closure_t));
|
closure = (hb_face_for_data_closure_t *) calloc (1, sizeof (hb_face_for_data_closure_t));
|
||||||
if (unlikely (!closure))
|
if (unlikely (!closure))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
closure->blob = blob;
|
closure->blob = blob;
|
||||||
closure->index = index;
|
closure->index = index;
|
||||||
|
|
|
@ -347,12 +347,12 @@ static const hb_font_funcs_t _hb_font_funcs_nil = {
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
|
|
||||||
{
|
{
|
||||||
#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
|
#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
|
||||||
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
||||||
#undef HB_FONT_FUNC_IMPLEMENT
|
#undef HB_FONT_FUNC_IMPLEMENT
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
|
#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
|
||||||
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
||||||
#undef HB_FONT_FUNC_IMPLEMENT
|
#undef HB_FONT_FUNC_IMPLEMENT
|
||||||
},
|
},
|
||||||
|
@ -370,12 +370,12 @@ static const hb_font_funcs_t _hb_font_funcs_parent = {
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
|
|
||||||
{
|
{
|
||||||
#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
|
#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
|
||||||
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
||||||
#undef HB_FONT_FUNC_IMPLEMENT
|
#undef HB_FONT_FUNC_IMPLEMENT
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
|
#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
|
||||||
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
|
||||||
#undef HB_FONT_FUNC_IMPLEMENT
|
#undef HB_FONT_FUNC_IMPLEMENT
|
||||||
},
|
},
|
||||||
|
@ -563,8 +563,8 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
|
||||||
ffuncs->destroy.name = destroy; \
|
ffuncs->destroy.name = destroy; \
|
||||||
} else { \
|
} else { \
|
||||||
ffuncs->get.f.name = hb_font_get_##name##_parent; \
|
ffuncs->get.f.name = hb_font_get_##name##_parent; \
|
||||||
ffuncs->user_data.name = NULL; \
|
ffuncs->user_data.name = nullptr; \
|
||||||
ffuncs->destroy.name = NULL; \
|
ffuncs->destroy.name = nullptr; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ hb_font_create_sub_font (hb_font_t *parent)
|
||||||
|
|
||||||
font->num_coords = parent->num_coords;
|
font->num_coords = parent->num_coords;
|
||||||
if (!font->num_coords)
|
if (!font->num_coords)
|
||||||
font->coords = NULL;
|
font->coords = nullptr;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int size = parent->num_coords * sizeof (parent->coords[0]);
|
unsigned int size = parent->num_coords * sizeof (parent->coords[0]);
|
||||||
|
@ -1192,7 +1192,7 @@ hb_font_get_empty (void)
|
||||||
|
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
|
|
||||||
NULL, /* parent */
|
nullptr, /* parent */
|
||||||
const_cast<hb_face_t *> (&_hb_face_nil),
|
const_cast<hb_face_t *> (&_hb_face_nil),
|
||||||
|
|
||||||
1000, /* x_scale */
|
1000, /* x_scale */
|
||||||
|
@ -1203,11 +1203,11 @@ hb_font_get_empty (void)
|
||||||
0, /* ptem */
|
0, /* ptem */
|
||||||
|
|
||||||
0, /* num_coords */
|
0, /* num_coords */
|
||||||
NULL, /* coords */
|
nullptr, /* coords */
|
||||||
|
|
||||||
const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
|
const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
|
||||||
NULL, /* user_data */
|
nullptr, /* user_data */
|
||||||
NULL, /* destroy */
|
nullptr, /* destroy */
|
||||||
|
|
||||||
{
|
{
|
||||||
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
|
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
|
||||||
|
@ -1639,13 +1639,13 @@ hb_font_set_variations (hb_font_t *font,
|
||||||
|
|
||||||
if (!variations_length)
|
if (!variations_length)
|
||||||
{
|
{
|
||||||
hb_font_set_var_coords_normalized (font, NULL, 0);
|
hb_font_set_var_coords_normalized (font, nullptr, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int coords_length = hb_ot_var_get_axis_count (font->face);
|
unsigned int coords_length = hb_ot_var_get_axis_count (font->face);
|
||||||
|
|
||||||
int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : NULL;
|
int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : nullptr;
|
||||||
if (unlikely (coords_length && !normalized))
|
if (unlikely (coords_length && !normalized))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1668,7 +1668,7 @@ hb_font_set_var_coords_design (hb_font_t *font,
|
||||||
if (font->immutable)
|
if (font->immutable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : NULL;
|
int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : nullptr;
|
||||||
if (unlikely (coords_length && !normalized))
|
if (unlikely (coords_length && !normalized))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1689,7 +1689,7 @@ hb_font_set_var_coords_normalized (hb_font_t *font,
|
||||||
if (font->immutable)
|
if (font->immutable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL;
|
int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : nullptr;
|
||||||
if (unlikely (coords_length && !copy))
|
if (unlikely (coords_length && !copy))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1749,7 +1749,7 @@ trampoline_create (FuncType func,
|
||||||
trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
|
trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
|
||||||
|
|
||||||
if (unlikely (!trampoline))
|
if (unlikely (!trampoline))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
trampoline->closure.user_data = user_data;
|
trampoline->closure.user_data = user_data;
|
||||||
trampoline->closure.destroy = destroy;
|
trampoline->closure.destroy = destroy;
|
||||||
|
|
56
src/hb-ft.cc
56
src/hb-ft.cc
|
@ -83,7 +83,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
|
||||||
hb_ft_font_t *ft_font = (hb_ft_font_t *) calloc (1, sizeof (hb_ft_font_t));
|
hb_ft_font_t *ft_font = (hb_ft_font_t *) calloc (1, sizeof (hb_ft_font_t));
|
||||||
|
|
||||||
if (unlikely (!ft_font))
|
if (unlikely (!ft_font))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
ft_font->ft_face = ft_face;
|
ft_font->ft_face = ft_face;
|
||||||
ft_font->symbol = symbol;
|
ft_font->symbol = symbol;
|
||||||
|
@ -158,7 +158,7 @@ FT_Face
|
||||||
hb_ft_font_get_face (hb_font_t *font)
|
hb_ft_font_get_face (hb_font_t *font)
|
||||||
{
|
{
|
||||||
if (font->destroy != _hb_ft_font_destroy)
|
if (font->destroy != _hb_ft_font_destroy)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data;
|
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data;
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hb_font_funcs_t *static_ft_funcs = NULL;
|
static hb_font_funcs_t *static_ft_funcs = nullptr;
|
||||||
|
|
||||||
#ifdef HB_USE_ATEXIT
|
#ifdef HB_USE_ATEXIT
|
||||||
static
|
static
|
||||||
|
@ -444,24 +444,24 @@ retry:
|
||||||
{
|
{
|
||||||
funcs = hb_font_funcs_create ();
|
funcs = hb_font_funcs_create ();
|
||||||
|
|
||||||
hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, NULL, NULL);
|
hb_font_funcs_set_font_h_extents_func (funcs, hb_ft_get_font_h_extents, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, NULL, NULL);
|
//hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, nullptr, nullptr);
|
||||||
hb_font_funcs_set_nominal_glyph_func (funcs, hb_ft_get_nominal_glyph, NULL, NULL);
|
hb_font_funcs_set_nominal_glyph_func (funcs, hb_ft_get_nominal_glyph, nullptr, nullptr);
|
||||||
hb_font_funcs_set_variation_glyph_func (funcs, hb_ft_get_variation_glyph, NULL, NULL);
|
hb_font_funcs_set_variation_glyph_func (funcs, hb_ft_get_variation_glyph, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, NULL, NULL);
|
hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, NULL, NULL);
|
hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, NULL, NULL);
|
//hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, NULL, NULL);
|
hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, NULL, NULL);
|
hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, NULL, NULL);
|
//hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, NULL, NULL);
|
hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_point, NULL, NULL);
|
hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_point, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, NULL, NULL);
|
hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_from_name_func (funcs, hb_ft_get_glyph_from_name, NULL, NULL);
|
hb_font_funcs_set_glyph_from_name_func (funcs, hb_ft_get_glyph_from_name, nullptr, nullptr);
|
||||||
|
|
||||||
hb_font_funcs_make_immutable (funcs);
|
hb_font_funcs_make_immutable (funcs);
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, NULL, funcs)) {
|
if (!hb_atomic_ptr_cmpexch (&static_ft_funcs, nullptr, funcs)) {
|
||||||
hb_font_funcs_destroy (funcs);
|
hb_font_funcs_destroy (funcs);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -490,17 +490,17 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
|
||||||
|
|
||||||
/* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */
|
/* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */
|
||||||
|
|
||||||
error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length);
|
error = FT_Load_Sfnt_Table (ft_face, tag, 0, nullptr, &length);
|
||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
buffer = (FT_Byte *) malloc (length);
|
buffer = (FT_Byte *) malloc (length);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length);
|
error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length);
|
||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return hb_blob_create ((const char *) buffer, length,
|
return hb_blob_create ((const char *) buffer, length,
|
||||||
HB_MEMORY_MODE_WRITABLE,
|
HB_MEMORY_MODE_WRITABLE,
|
||||||
|
@ -581,7 +581,7 @@ hb_ft_face_create_cached (FT_Face ft_face)
|
||||||
if (ft_face->generic.finalizer)
|
if (ft_face->generic.finalizer)
|
||||||
ft_face->generic.finalizer (ft_face);
|
ft_face->generic.finalizer (ft_face);
|
||||||
|
|
||||||
ft_face->generic.data = hb_ft_face_create (ft_face, NULL);
|
ft_face->generic.data = hb_ft_face_create (ft_face, nullptr);
|
||||||
ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
|
ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ hb_ft_font_changed (hb_font_t *font)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FT_GET_VAR_BLEND_COORDINATES
|
#ifdef HAVE_FT_GET_VAR_BLEND_COORDINATES
|
||||||
FT_MM_Var *mm_var = NULL;
|
FT_MM_Var *mm_var = nullptr;
|
||||||
if (!FT_Get_MM_Var (ft_face, &mm_var))
|
if (!FT_Get_MM_Var (ft_face, &mm_var))
|
||||||
{
|
{
|
||||||
FT_Fixed *ft_coords = (FT_Fixed *) calloc (mm_var->num_axis, sizeof (FT_Fixed));
|
FT_Fixed *ft_coords = (FT_Fixed *) calloc (mm_var->num_axis, sizeof (FT_Fixed));
|
||||||
|
@ -694,9 +694,9 @@ retry:
|
||||||
{
|
{
|
||||||
/* Not found; allocate one. */
|
/* Not found; allocate one. */
|
||||||
if (FT_Init_FreeType (&library))
|
if (FT_Init_FreeType (&library))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&ft_library, NULL, library)) {
|
if (!hb_atomic_ptr_cmpexch (&ft_library, nullptr, library)) {
|
||||||
FT_Done_FreeType (library);
|
FT_Done_FreeType (library);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -724,7 +724,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
|
||||||
if (unlikely (!blob_length))
|
if (unlikely (!blob_length))
|
||||||
DEBUG_MSG (FT, font, "Font face has empty blob");
|
DEBUG_MSG (FT, font, "Font face has empty blob");
|
||||||
|
|
||||||
FT_Face ft_face = NULL;
|
FT_Face ft_face = nullptr;
|
||||||
FT_Error err = FT_New_Memory_Face (get_ft_library (),
|
FT_Error err = FT_New_Memory_Face (get_ft_library (),
|
||||||
(const FT_Byte *) blob_data,
|
(const FT_Byte *) blob_data,
|
||||||
blob_length,
|
blob_length,
|
||||||
|
@ -751,7 +751,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
|
||||||
{
|
{
|
||||||
FT_Matrix matrix = { font->x_scale < 0 ? -1 : +1, 0,
|
FT_Matrix matrix = { font->x_scale < 0 ? -1 : +1, 0,
|
||||||
0, font->y_scale < 0 ? -1 : +1};
|
0, font->y_scale < 0 ? -1 : +1};
|
||||||
FT_Set_Transform (ft_face, &matrix, NULL);
|
FT_Set_Transform (ft_face, &matrix, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int num_coords;
|
unsigned int num_coords;
|
||||||
|
|
|
@ -370,7 +370,7 @@ hb_glib_get_unicode_funcs (void)
|
||||||
static const hb_unicode_funcs_t _hb_glib_unicode_funcs = {
|
static const hb_unicode_funcs_t _hb_glib_unicode_funcs = {
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
NULL, /* parent */
|
nullptr, /* parent */
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
{
|
{
|
||||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_glib_unicode_##name,
|
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_glib_unicode_##name,
|
||||||
|
|
|
@ -58,7 +58,7 @@ hb_gobject_##name##_get_type (void) \
|
||||||
static hb_##name##_t *_hb_##name##_reference (const hb_##name##_t *l) \
|
static hb_##name##_t *_hb_##name##_reference (const hb_##name##_t *l) \
|
||||||
{ \
|
{ \
|
||||||
hb_##name##_t *c = (hb_##name##_t *) calloc (1, sizeof (hb_##name##_t)); \
|
hb_##name##_t *c = (hb_##name##_t *) calloc (1, sizeof (hb_##name##_t)); \
|
||||||
if (unlikely (!c)) return NULL; \
|
if (unlikely (!c)) return nullptr; \
|
||||||
*c = *l; \
|
*c = *l; \
|
||||||
return c; \
|
return c; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -59,7 +59,7 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
|
||||||
hb_graphite2_shaper_face_data_t *face_data = (hb_graphite2_shaper_face_data_t *) data;
|
hb_graphite2_shaper_face_data_t *face_data = (hb_graphite2_shaper_face_data_t *) data;
|
||||||
hb_graphite2_tablelist_t *tlist = face_data->tlist;
|
hb_graphite2_tablelist_t *tlist = face_data->tlist;
|
||||||
|
|
||||||
hb_blob_t *blob = NULL;
|
hb_blob_t *blob = nullptr;
|
||||||
|
|
||||||
for (hb_graphite2_tablelist_t *p = tlist; p; p = p->next)
|
for (hb_graphite2_tablelist_t *p = tlist; p; p = p->next)
|
||||||
if (p->tag == tag) {
|
if (p->tag == tag) {
|
||||||
|
@ -74,7 +74,7 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
|
||||||
hb_graphite2_tablelist_t *p = (hb_graphite2_tablelist_t *) calloc (1, sizeof (hb_graphite2_tablelist_t));
|
hb_graphite2_tablelist_t *p = (hb_graphite2_tablelist_t *) calloc (1, sizeof (hb_graphite2_tablelist_t));
|
||||||
if (unlikely (!p)) {
|
if (unlikely (!p)) {
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
p->blob = blob;
|
p->blob = blob;
|
||||||
p->tag = tag;
|
p->tag = tag;
|
||||||
|
@ -100,20 +100,20 @@ _hb_graphite2_shaper_face_data_create (hb_face_t *face)
|
||||||
if (!hb_blob_get_length (silf_blob))
|
if (!hb_blob_get_length (silf_blob))
|
||||||
{
|
{
|
||||||
hb_blob_destroy (silf_blob);
|
hb_blob_destroy (silf_blob);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
hb_blob_destroy (silf_blob);
|
hb_blob_destroy (silf_blob);
|
||||||
|
|
||||||
hb_graphite2_shaper_face_data_t *data = (hb_graphite2_shaper_face_data_t *) calloc (1, sizeof (hb_graphite2_shaper_face_data_t));
|
hb_graphite2_shaper_face_data_t *data = (hb_graphite2_shaper_face_data_t *) calloc (1, sizeof (hb_graphite2_shaper_face_data_t));
|
||||||
if (unlikely (!data))
|
if (unlikely (!data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
data->face = face;
|
data->face = face;
|
||||||
data->grface = gr_make_face (data, &hb_graphite2_get_table, gr_face_preloadAll);
|
data->grface = gr_make_face (data, &hb_graphite2_get_table, gr_face_preloadAll);
|
||||||
|
|
||||||
if (unlikely (!data->grface)) {
|
if (unlikely (!data->grface)) {
|
||||||
free (data);
|
free (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -143,7 +143,7 @@ _hb_graphite2_shaper_face_data_destroy (hb_graphite2_shaper_face_data_t *data)
|
||||||
gr_face *
|
gr_face *
|
||||||
hb_graphite2_face_get_gr_face (hb_face_t *face)
|
hb_graphite2_face_get_gr_face (hb_face_t *face)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_graphite2_shaper_face_data_ensure (face))) return NULL;
|
if (unlikely (!hb_graphite2_shaper_face_data_ensure (face))) return nullptr;
|
||||||
return HB_SHAPER_DATA_GET (face)->grface;
|
return HB_SHAPER_DATA_GET (face)->grface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ _hb_graphite2_shaper_font_data_destroy (hb_graphite2_shaper_font_data_t *data HB
|
||||||
gr_font *
|
gr_font *
|
||||||
hb_graphite2_font_get_gr_font (hb_font_t *font)
|
hb_graphite2_font_get_gr_font (hb_font_t *font)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
||||||
gr_face *grface = HB_SHAPER_DATA_GET (face)->grface;
|
gr_face *grface = HB_SHAPER_DATA_GET (face)->grface;
|
||||||
|
|
||||||
const char *lang = hb_language_to_string (hb_buffer_get_language (buffer));
|
const char *lang = hb_language_to_string (hb_buffer_get_language (buffer));
|
||||||
const char *lang_end = lang ? strchr (lang, '-') : NULL;
|
const char *lang_end = lang ? strchr (lang, '-') : nullptr;
|
||||||
int lang_len = lang_end ? lang_end - lang : -1;
|
int lang_len = lang_end ? lang_end - lang : -1;
|
||||||
gr_feature_val *feats = gr_face_featureval_for_lang (grface, lang ? hb_tag_from_string (lang, lang_len) : 0);
|
gr_feature_val *feats = gr_face_featureval_for_lang (grface, lang ? hb_tag_from_string (lang, lang_len) : 0);
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
||||||
gr_fref_set_feature_value (fref, features[i].value, feats);
|
gr_fref_set_feature_value (fref, features[i].value, feats);
|
||||||
}
|
}
|
||||||
|
|
||||||
gr_segment *seg = NULL;
|
gr_segment *seg = nullptr;
|
||||||
const gr_slot *is;
|
const gr_slot *is;
|
||||||
unsigned int ci = 0, ic = 0;
|
unsigned int ci = 0, ic = 0;
|
||||||
float curradvx = 0., curradvy = 0.;
|
float curradvx = 0., curradvy = 0.;
|
||||||
|
@ -250,7 +250,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
||||||
hb_tag_t script_tag[2];
|
hb_tag_t script_tag[2];
|
||||||
hb_ot_tags_from_script (hb_buffer_get_script (buffer), &script_tag[0], &script_tag[1]);
|
hb_ot_tags_from_script (hb_buffer_get_script (buffer), &script_tag[0], &script_tag[1]);
|
||||||
|
|
||||||
seg = gr_make_seg (NULL, grface,
|
seg = gr_make_seg (nullptr, grface,
|
||||||
script_tag[1] == HB_TAG_NONE ? script_tag[0] : script_tag[1],
|
script_tag[1] == HB_TAG_NONE ? script_tag[0] : script_tag[1],
|
||||||
feats,
|
feats,
|
||||||
gr_utf32, chars, buffer->len,
|
gr_utf32, chars, buffer->len,
|
||||||
|
@ -368,7 +368,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
||||||
/* Positioning. */
|
/* Positioning. */
|
||||||
unsigned int currclus = (unsigned int) -1;
|
unsigned int currclus = (unsigned int) -1;
|
||||||
const hb_glyph_info_t *info = buffer->info;
|
const hb_glyph_info_t *info = buffer->info;
|
||||||
hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL);
|
hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, nullptr);
|
||||||
if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
|
if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
|
||||||
{
|
{
|
||||||
curradvx = 0;
|
curradvx = 0;
|
||||||
|
@ -383,7 +383,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
||||||
} else
|
} else
|
||||||
pPos->x_advance = 0.;
|
pPos->x_advance = 0.;
|
||||||
|
|
||||||
pPos->y_advance = gr_slot_advance_Y (is, grface, NULL) * yscale;
|
pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale;
|
||||||
curradvy += pPos->y_advance;
|
curradvy += pPos->y_advance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
|
||||||
} else
|
} else
|
||||||
pPos->x_advance = 0.;
|
pPos->x_advance = 0.;
|
||||||
|
|
||||||
pPos->y_advance = gr_slot_advance_Y (is, grface, NULL) * yscale;
|
pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale;
|
||||||
curradvy -= pPos->y_advance;
|
curradvy -= pPos->y_advance;
|
||||||
pPos->x_offset = (gr_slot_origin_X (is) - info->var1.i32) * xscale - curradvx + pPos->x_advance;
|
pPos->x_offset = (gr_slot_origin_X (is) - info->var1.i32) * xscale - curradvx + pPos->x_advance;
|
||||||
pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy;
|
pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy;
|
||||||
|
|
|
@ -351,7 +351,7 @@ hb_icu_get_unicode_funcs (void)
|
||||||
static const hb_unicode_funcs_t _hb_icu_unicode_funcs = {
|
static const hb_unicode_funcs_t _hb_icu_unicode_funcs = {
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
NULL, /* parent */
|
nullptr, /* parent */
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
{
|
{
|
||||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_icu_unicode_##name,
|
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_icu_unicode_##name,
|
||||||
|
@ -364,7 +364,7 @@ hb_icu_get_unicode_funcs (void)
|
||||||
if (!hb_atomic_ptr_get (&normalizer)) {
|
if (!hb_atomic_ptr_get (&normalizer)) {
|
||||||
UErrorCode icu_err = U_ZERO_ERROR;
|
UErrorCode icu_err = U_ZERO_ERROR;
|
||||||
/* We ignore failure in getNFCInstace(). */
|
/* We ignore failure in getNFCInstace(). */
|
||||||
(void) hb_atomic_ptr_cmpexch (&normalizer, NULL, unorm2_getNFCInstance (&icu_err));
|
(void) hb_atomic_ptr_cmpexch (&normalizer, nullptr, unorm2_getNFCInstance (&icu_err));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return const_cast<hb_unicode_funcs_t *> (&_hb_icu_unicode_funcs);
|
return const_cast<hb_unicode_funcs_t *> (&_hb_icu_unicode_funcs);
|
||||||
|
|
|
@ -68,7 +68,7 @@ typedef CRITICAL_SECTION hb_mutex_impl_t;
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
typedef pthread_mutex_t hb_mutex_impl_t;
|
typedef pthread_mutex_t hb_mutex_impl_t;
|
||||||
#define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER
|
#define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER
|
||||||
#define hb_mutex_impl_init(M) pthread_mutex_init (M, NULL)
|
#define hb_mutex_impl_init(M) pthread_mutex_init (M, nullptr)
|
||||||
#define hb_mutex_impl_lock(M) pthread_mutex_lock (M)
|
#define hb_mutex_impl_lock(M) pthread_mutex_lock (M)
|
||||||
#define hb_mutex_impl_unlock(M) pthread_mutex_unlock (M)
|
#define hb_mutex_impl_unlock(M) pthread_mutex_unlock (M)
|
||||||
#define hb_mutex_impl_finish(M) pthread_mutex_destroy (M)
|
#define hb_mutex_impl_finish(M) pthread_mutex_destroy (M)
|
||||||
|
|
|
@ -193,7 +193,7 @@ static inline void *hb_object_get_user_data (Type *obj,
|
||||||
hb_user_data_key_t *key)
|
hb_user_data_key_t *key)
|
||||||
{
|
{
|
||||||
if (unlikely (!obj || hb_object_is_inert (obj)))
|
if (unlikely (!obj || hb_object_is_inert (obj)))
|
||||||
return NULL;
|
return nullptr;
|
||||||
assert (hb_object_is_valid (obj));
|
assert (hb_object_is_valid (obj));
|
||||||
return obj->header.user_data.get (key);
|
return obj->header.user_data.get (key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,9 +192,9 @@ struct hb_sanitize_context_t :
|
||||||
{
|
{
|
||||||
inline hb_sanitize_context_t (void) :
|
inline hb_sanitize_context_t (void) :
|
||||||
debug_depth (0),
|
debug_depth (0),
|
||||||
start (NULL), end (NULL),
|
start (nullptr), end (nullptr),
|
||||||
writable (false), edit_count (0),
|
writable (false), edit_count (0),
|
||||||
blob (NULL) {}
|
blob (nullptr) {}
|
||||||
|
|
||||||
inline const char *get_name (void) { return "SANITIZE"; }
|
inline const char *get_name (void) { return "SANITIZE"; }
|
||||||
template <typename T, typename F>
|
template <typename T, typename F>
|
||||||
|
@ -214,7 +214,7 @@ struct hb_sanitize_context_t :
|
||||||
|
|
||||||
inline void start_processing (void)
|
inline void start_processing (void)
|
||||||
{
|
{
|
||||||
this->start = hb_blob_get_data (this->blob, NULL);
|
this->start = hb_blob_get_data (this->blob, nullptr);
|
||||||
this->end = this->start + hb_blob_get_length (this->blob);
|
this->end = this->start + hb_blob_get_length (this->blob);
|
||||||
assert (this->start <= this->end); /* Must not overflow. */
|
assert (this->start <= this->end); /* Must not overflow. */
|
||||||
this->edit_count = 0;
|
this->edit_count = 0;
|
||||||
|
@ -233,8 +233,8 @@ struct hb_sanitize_context_t :
|
||||||
this->start, this->end, this->edit_count);
|
this->start, this->end, this->edit_count);
|
||||||
|
|
||||||
hb_blob_destroy (this->blob);
|
hb_blob_destroy (this->blob);
|
||||||
this->blob = NULL;
|
this->blob = nullptr;
|
||||||
this->start = this->end = NULL;
|
this->start = this->end = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool check_range (const void *base, unsigned int len) const
|
inline bool check_range (const void *base, unsigned int len) const
|
||||||
|
@ -349,7 +349,7 @@ struct Sanitizer
|
||||||
} else {
|
} else {
|
||||||
unsigned int edit_count = c->edit_count;
|
unsigned int edit_count = c->edit_count;
|
||||||
if (edit_count && !c->writable) {
|
if (edit_count && !c->writable) {
|
||||||
c->start = hb_blob_get_data_writable (blob, NULL);
|
c->start = hb_blob_get_data_writable (blob, nullptr);
|
||||||
c->end = c->start + hb_blob_get_length (blob);
|
c->end = c->start + hb_blob_get_length (blob);
|
||||||
|
|
||||||
if (c->start) {
|
if (c->start) {
|
||||||
|
@ -374,7 +374,7 @@ struct Sanitizer
|
||||||
|
|
||||||
static const Type* lock_instance (hb_blob_t *blob) {
|
static const Type* lock_instance (hb_blob_t *blob) {
|
||||||
hb_blob_make_immutable (blob);
|
hb_blob_make_immutable (blob);
|
||||||
const char *base = hb_blob_get_data (blob, NULL);
|
const char *base = hb_blob_get_data (blob, nullptr);
|
||||||
return unlikely (!base) ? &Null(Type) : CastP<Type> (base);
|
return unlikely (!base) ? &Null(Type) : CastP<Type> (base);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -445,7 +445,7 @@ struct hb_serialize_context_t
|
||||||
{
|
{
|
||||||
if (unlikely (this->ran_out_of_room || this->end - this->head < ptrdiff_t (size))) {
|
if (unlikely (this->ran_out_of_room || this->end - this->head < ptrdiff_t (size))) {
|
||||||
this->ran_out_of_room = true;
|
this->ran_out_of_room = true;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
memset (this->head, 0, size);
|
memset (this->head, 0, size);
|
||||||
char *ret = this->head;
|
char *ret = this->head;
|
||||||
|
@ -471,7 +471,7 @@ struct hb_serialize_context_t
|
||||||
{
|
{
|
||||||
unsigned int size = obj.get_size ();
|
unsigned int size = obj.get_size ();
|
||||||
Type *ret = this->allocate_size<Type> (size);
|
Type *ret = this->allocate_size<Type> (size);
|
||||||
if (unlikely (!ret)) return NULL;
|
if (unlikely (!ret)) return nullptr;
|
||||||
memcpy (ret, obj, size);
|
memcpy (ret, obj, size);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ struct hb_serialize_context_t
|
||||||
{
|
{
|
||||||
unsigned int size = obj.min_size;
|
unsigned int size = obj.min_size;
|
||||||
assert (this->start <= (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head);
|
assert (this->start <= (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head);
|
||||||
if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return NULL;
|
if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return nullptr;
|
||||||
return reinterpret_cast<Type *> (&obj);
|
return reinterpret_cast<Type *> (&obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ struct hb_serialize_context_t
|
||||||
{
|
{
|
||||||
unsigned int size = obj.get_size ();
|
unsigned int size = obj.get_size ();
|
||||||
assert (this->start < (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head);
|
assert (this->start < (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head);
|
||||||
if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return NULL;
|
if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return nullptr;
|
||||||
return reinterpret_cast<Type *> (&obj);
|
return reinterpret_cast<Type *> (&obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,7 +1073,7 @@ struct hb_lazy_loader_t
|
||||||
inline void init (hb_face_t *face_)
|
inline void init (hb_face_t *face_)
|
||||||
{
|
{
|
||||||
face = face_;
|
face = face_;
|
||||||
instance = NULL;
|
instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fini (void)
|
inline void fini (void)
|
||||||
|
@ -1096,7 +1096,7 @@ struct hb_lazy_loader_t
|
||||||
p = const_cast<T *> (&OT::Null(T));
|
p = const_cast<T *> (&OT::Null(T));
|
||||||
else
|
else
|
||||||
p->init (face);
|
p->init (face);
|
||||||
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
|
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p)))
|
||||||
{
|
{
|
||||||
if (p != &OT::Null(T))
|
if (p != &OT::Null(T))
|
||||||
p->fini ();
|
p->fini ();
|
||||||
|
@ -1123,8 +1123,8 @@ struct hb_lazy_table_loader_t
|
||||||
inline void init (hb_face_t *face_)
|
inline void init (hb_face_t *face_)
|
||||||
{
|
{
|
||||||
face = face_;
|
face = face_;
|
||||||
instance = NULL;
|
instance = nullptr;
|
||||||
blob = NULL;
|
blob = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fini (void)
|
inline void fini (void)
|
||||||
|
@ -1140,7 +1140,7 @@ struct hb_lazy_table_loader_t
|
||||||
{
|
{
|
||||||
hb_blob_t *blob_ = OT::Sanitizer<T>::sanitize (face->reference_table (T::tableTag));
|
hb_blob_t *blob_ = OT::Sanitizer<T>::sanitize (face->reference_table (T::tableTag));
|
||||||
p = const_cast<T *>(OT::Sanitizer<T>::lock_instance (blob_));
|
p = const_cast<T *>(OT::Sanitizer<T>::lock_instance (blob_));
|
||||||
if (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p))
|
if (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p))
|
||||||
{
|
{
|
||||||
hb_blob_destroy (blob_);
|
hb_blob_destroy (blob_);
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
|
@ -245,7 +245,7 @@ struct IndexSubtableArray
|
||||||
return &indexSubtablesZ[i];
|
return &indexSubtablesZ[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -344,7 +344,7 @@ struct CBLC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -508,7 +508,7 @@ struct cmap
|
||||||
* unsorted subtable list. */
|
* unsorted subtable list. */
|
||||||
int result = encodingRecord./*bsearch*/lsearch (key);
|
int result = encodingRecord./*bsearch*/lsearch (key);
|
||||||
if (result == -1 || !encodingRecord[result].subtable)
|
if (result == -1 || !encodingRecord[result].subtable)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return &(this+encodingRecord[result].subtable);
|
return &(this+encodingRecord[result].subtable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,8 +235,8 @@ struct hb_ot_face_cbdt_accelerator_t
|
||||||
cbdt_len = hb_blob_get_length (cbdt_blob);
|
cbdt_len = hb_blob_get_length (cbdt_blob);
|
||||||
|
|
||||||
if (hb_blob_get_length (cblc_blob) == 0) {
|
if (hb_blob_get_length (cblc_blob) == 0) {
|
||||||
cblc = NULL;
|
cblc = nullptr;
|
||||||
cbdt = NULL;
|
cbdt = nullptr;
|
||||||
return; /* Not a bitmap font. */
|
return; /* Not a bitmap font. */
|
||||||
}
|
}
|
||||||
cblc = OT::Sanitizer<OT::CBLC>::lock_instance (cblc_blob);
|
cblc = OT::Sanitizer<OT::CBLC>::lock_instance (cblc_blob);
|
||||||
|
@ -349,8 +349,8 @@ struct hb_ot_face_cmap_accelerator_t
|
||||||
{
|
{
|
||||||
this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
|
this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
|
||||||
const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
|
const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
|
||||||
const OT::CmapSubtable *subtable = NULL;
|
const OT::CmapSubtable *subtable = nullptr;
|
||||||
const OT::CmapSubtableFormat14 *subtable_uvs = NULL;
|
const OT::CmapSubtableFormat14 *subtable_uvs = nullptr;
|
||||||
|
|
||||||
bool symbol = false;
|
bool symbol = false;
|
||||||
/* 32-bit subtables. */
|
/* 32-bit subtables. */
|
||||||
|
@ -445,7 +445,7 @@ _hb_ot_font_create (hb_face_t *face)
|
||||||
hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t));
|
hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t));
|
||||||
|
|
||||||
if (unlikely (!ot_font))
|
if (unlikely (!ot_font))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
ot_font->cmap.init (face);
|
ot_font->cmap.init (face);
|
||||||
ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_HVAR, HB_OT_TAG_os2);
|
ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_HVAR, HB_OT_TAG_os2);
|
||||||
|
@ -563,7 +563,7 @@ hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED,
|
||||||
return ot_font->v_metrics.has_font_extents;
|
return ot_font->v_metrics.has_font_extents;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hb_font_funcs_t *static_ot_funcs = NULL;
|
static hb_font_funcs_t *static_ot_funcs = nullptr;
|
||||||
|
|
||||||
#ifdef HB_USE_ATEXIT
|
#ifdef HB_USE_ATEXIT
|
||||||
static
|
static
|
||||||
|
@ -583,24 +583,24 @@ retry:
|
||||||
{
|
{
|
||||||
funcs = hb_font_funcs_create ();
|
funcs = hb_font_funcs_create ();
|
||||||
|
|
||||||
hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, NULL, NULL);
|
hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, nullptr, nullptr);
|
||||||
hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, NULL, NULL);
|
hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, nullptr, nullptr);
|
||||||
hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, NULL, NULL);
|
hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, nullptr, nullptr);
|
||||||
hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, NULL, NULL);
|
hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, NULL, NULL);
|
hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, NULL, NULL);
|
hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, NULL, NULL);
|
//hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, NULL, NULL);
|
//hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, NULL, NULL); TODO
|
//hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, nullptr, nullptr); TODO
|
||||||
//hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, NULL, NULL);
|
//hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, nullptr, nullptr);
|
||||||
hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, NULL, NULL);
|
hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr);
|
||||||
//hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, NULL, NULL); TODO
|
//hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr); TODO
|
||||||
//hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, NULL, NULL); TODO
|
//hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, nullptr, nullptr); TODO
|
||||||
//hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, NULL, NULL); TODO
|
//hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, nullptr, nullptr); TODO
|
||||||
|
|
||||||
hb_font_funcs_make_immutable (funcs);
|
hb_font_funcs_make_immutable (funcs);
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, NULL, funcs)) {
|
if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, nullptr, funcs)) {
|
||||||
hb_font_funcs_destroy (funcs);
|
hb_font_funcs_destroy (funcs);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ struct LangSys
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
const Record<LangSys>::sanitize_closure_t * = NULL) const
|
const Record<LangSys>::sanitize_closure_t * = nullptr) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (c->check_struct (this) && featureIndex.sanitize (c));
|
return_trace (c->check_struct (this) && featureIndex.sanitize (c));
|
||||||
|
@ -254,7 +254,7 @@ struct Script
|
||||||
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
const Record<Script>::sanitize_closure_t * = NULL) const
|
const Record<Script>::sanitize_closure_t * = nullptr) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this));
|
return_trace (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this));
|
||||||
|
@ -435,17 +435,17 @@ struct FeatureParamsCharacterVariants
|
||||||
* specifies a string (or strings,
|
* specifies a string (or strings,
|
||||||
* for multiple languages) for a
|
* for multiple languages) for a
|
||||||
* user-interface label for this
|
* user-interface label for this
|
||||||
* feature. (May be NULL.) */
|
* feature. (May be nullptr.) */
|
||||||
USHORT featUITooltipTextNameID;/* The ‘name’ table name ID that
|
USHORT featUITooltipTextNameID;/* The ‘name’ table name ID that
|
||||||
* specifies a string (or strings,
|
* specifies a string (or strings,
|
||||||
* for multiple languages) that an
|
* for multiple languages) that an
|
||||||
* application can use for tooltip
|
* application can use for tooltip
|
||||||
* text for this feature. (May be
|
* text for this feature. (May be
|
||||||
* NULL.) */
|
* nullptr.) */
|
||||||
USHORT sampleTextNameID; /* The ‘name’ table name ID that
|
USHORT sampleTextNameID; /* The ‘name’ table name ID that
|
||||||
* specifies sample text that
|
* specifies sample text that
|
||||||
* illustrates the effect of this
|
* illustrates the effect of this
|
||||||
* feature. (May be NULL.) */
|
* feature. (May be nullptr.) */
|
||||||
USHORT numNamedParameters; /* Number of named parameters. (May
|
USHORT numNamedParameters; /* Number of named parameters. (May
|
||||||
* be zero.) */
|
* be zero.) */
|
||||||
USHORT firstParamUILabelNameID;/* The first ‘name’ table name ID
|
USHORT firstParamUILabelNameID;/* The first ‘name’ table name ID
|
||||||
|
@ -507,7 +507,7 @@ struct Feature
|
||||||
{ return this+featureParams; }
|
{ return this+featureParams; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
const Record<Feature>::sanitize_closure_t *closure = NULL) const
|
const Record<Feature>::sanitize_closure_t *closure = nullptr) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
|
if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
|
||||||
|
@ -1458,7 +1458,7 @@ struct FeatureTableSubstitution
|
||||||
if (record.featureIndex == feature_index)
|
if (record.featureIndex == feature_index)
|
||||||
return &(this+record.feature);
|
return &(this+record.feature);
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
|
|
|
@ -658,7 +658,7 @@ struct Ligature
|
||||||
if (likely (!match_input (c, count,
|
if (likely (!match_input (c, count,
|
||||||
&component[1],
|
&component[1],
|
||||||
match_glyph,
|
match_glyph,
|
||||||
NULL,
|
nullptr,
|
||||||
&match_length,
|
&match_length,
|
||||||
match_positions,
|
match_positions,
|
||||||
&is_mark_ligature,
|
&is_mark_ligature,
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct hb_closure_context_t :
|
||||||
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
|
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
|
||||||
face (face_),
|
face (face_),
|
||||||
glyphs (glyphs_),
|
glyphs (glyphs_),
|
||||||
recurse_func (NULL),
|
recurse_func (nullptr),
|
||||||
nesting_level_left (nesting_level_left_),
|
nesting_level_left (nesting_level_left_),
|
||||||
debug_depth (0) {}
|
debug_depth (0) {}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ struct hb_collect_glyphs_context_t :
|
||||||
if (unlikely (nesting_level_left == 0 || !recurse_func))
|
if (unlikely (nesting_level_left == 0 || !recurse_func))
|
||||||
return default_return_value ();
|
return default_return_value ();
|
||||||
|
|
||||||
/* Note that GPOS sets recurse_func to NULL already, so it doesn't get
|
/* Note that GPOS sets recurse_func to nullptr already, so it doesn't get
|
||||||
* past the previous check. For GSUB, we only want to collect the output
|
* past the previous check. For GSUB, we only want to collect the output
|
||||||
* glyphs in the recursion. If output is not requested, we can go home now.
|
* glyphs in the recursion. If output is not requested, we can go home now.
|
||||||
*
|
*
|
||||||
|
@ -192,17 +192,17 @@ struct hb_collect_glyphs_context_t :
|
||||||
unsigned int debug_depth;
|
unsigned int debug_depth;
|
||||||
|
|
||||||
hb_collect_glyphs_context_t (hb_face_t *face_,
|
hb_collect_glyphs_context_t (hb_face_t *face_,
|
||||||
hb_set_t *glyphs_before, /* OUT. May be NULL */
|
hb_set_t *glyphs_before, /* OUT. May be nullptr */
|
||||||
hb_set_t *glyphs_input, /* OUT. May be NULL */
|
hb_set_t *glyphs_input, /* OUT. May be nullptr */
|
||||||
hb_set_t *glyphs_after, /* OUT. May be NULL */
|
hb_set_t *glyphs_after, /* OUT. May be nullptr */
|
||||||
hb_set_t *glyphs_output, /* OUT. May be NULL */
|
hb_set_t *glyphs_output, /* OUT. May be nullptr */
|
||||||
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
|
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
|
||||||
face (face_),
|
face (face_),
|
||||||
before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
|
before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
|
||||||
input (glyphs_input ? glyphs_input : hb_set_get_empty ()),
|
input (glyphs_input ? glyphs_input : hb_set_get_empty ()),
|
||||||
after (glyphs_after ? glyphs_after : hb_set_get_empty ()),
|
after (glyphs_after ? glyphs_after : hb_set_get_empty ()),
|
||||||
output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
|
output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
|
||||||
recurse_func (NULL),
|
recurse_func (nullptr),
|
||||||
recursed_lookups (),
|
recursed_lookups (),
|
||||||
nesting_level_left (nesting_level_left_),
|
nesting_level_left (nesting_level_left_),
|
||||||
debug_depth (0)
|
debug_depth (0)
|
||||||
|
@ -273,8 +273,8 @@ struct hb_apply_context_t :
|
||||||
#define arg1(arg) (arg) /* Remove the macro to see why it's needed! */
|
#define arg1(arg) (arg) /* Remove the macro to see why it's needed! */
|
||||||
syllable arg1(0),
|
syllable arg1(0),
|
||||||
#undef arg1
|
#undef arg1
|
||||||
match_func (NULL),
|
match_func (nullptr),
|
||||||
match_data (NULL) {};
|
match_data (nullptr) {};
|
||||||
|
|
||||||
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
|
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
|
||||||
|
|
||||||
|
@ -342,8 +342,8 @@ struct hb_apply_context_t :
|
||||||
inline void init (hb_apply_context_t *c_, bool context_match = false)
|
inline void init (hb_apply_context_t *c_, bool context_match = false)
|
||||||
{
|
{
|
||||||
c = c_;
|
c = c_;
|
||||||
match_glyph_data = NULL;
|
match_glyph_data = nullptr;
|
||||||
matcher.set_match_func (NULL, NULL);
|
matcher.set_match_func (nullptr, nullptr);
|
||||||
matcher.set_lookup_props (c->lookup_props);
|
matcher.set_lookup_props (c->lookup_props);
|
||||||
/* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
|
/* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
|
||||||
matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && c->auto_zwnj));
|
matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && c->auto_zwnj));
|
||||||
|
@ -491,7 +491,7 @@ struct hb_apply_context_t :
|
||||||
hb_buffer_t *buffer_) :
|
hb_buffer_t *buffer_) :
|
||||||
iter_input (), iter_context (),
|
iter_input (), iter_context (),
|
||||||
font (font_), face (font->face), buffer (buffer_),
|
font (font_), face (font->face), buffer (buffer_),
|
||||||
recurse_func (NULL),
|
recurse_func (nullptr),
|
||||||
gdef (*hb_ot_layout_from_face (face)->gdef),
|
gdef (*hb_ot_layout_from_face (face)->gdef),
|
||||||
var_store (gdef.get_var_store ()),
|
var_store (gdef.get_var_store ()),
|
||||||
direction (buffer_->props.direction),
|
direction (buffer_->props.direction),
|
||||||
|
@ -719,10 +719,10 @@ static inline bool match_input (hb_apply_context_t *c,
|
||||||
const void *match_data,
|
const void *match_data,
|
||||||
unsigned int *end_offset,
|
unsigned int *end_offset,
|
||||||
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
|
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
|
||||||
bool *p_is_mark_ligature = NULL,
|
bool *p_is_mark_ligature = nullptr,
|
||||||
unsigned int *p_total_component_count = NULL)
|
unsigned int *p_total_component_count = nullptr)
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (nullptr);
|
||||||
|
|
||||||
if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
|
if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
|
||||||
|
|
||||||
|
@ -846,7 +846,7 @@ static inline bool ligate_input (hb_apply_context_t *c,
|
||||||
bool is_mark_ligature,
|
bool is_mark_ligature,
|
||||||
unsigned int total_component_count)
|
unsigned int total_component_count)
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (nullptr);
|
||||||
|
|
||||||
hb_buffer_t *buffer = c->buffer;
|
hb_buffer_t *buffer = c->buffer;
|
||||||
|
|
||||||
|
@ -943,7 +943,7 @@ static inline bool match_backtrack (hb_apply_context_t *c,
|
||||||
const void *match_data,
|
const void *match_data,
|
||||||
unsigned int *match_start)
|
unsigned int *match_start)
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (nullptr);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
|
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
|
||||||
skippy_iter.reset (c->buffer->backtrack_len (), count);
|
skippy_iter.reset (c->buffer->backtrack_len (), count);
|
||||||
|
@ -966,7 +966,7 @@ static inline bool match_lookahead (hb_apply_context_t *c,
|
||||||
unsigned int offset,
|
unsigned int offset,
|
||||||
unsigned int *end_index)
|
unsigned int *end_index)
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (nullptr);
|
||||||
|
|
||||||
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
|
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
|
||||||
skippy_iter.reset (c->buffer->idx + offset - 1, count);
|
skippy_iter.reset (c->buffer->idx + offset - 1, count);
|
||||||
|
@ -1016,7 +1016,7 @@ static inline bool apply_lookup (hb_apply_context_t *c,
|
||||||
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
|
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
|
||||||
unsigned int match_length)
|
unsigned int match_length)
|
||||||
{
|
{
|
||||||
TRACE_APPLY (NULL);
|
TRACE_APPLY (nullptr);
|
||||||
|
|
||||||
hb_buffer_t *buffer = c->buffer;
|
hb_buffer_t *buffer = c->buffer;
|
||||||
int end;
|
int end;
|
||||||
|
@ -1334,7 +1334,7 @@ struct ContextFormat1
|
||||||
|
|
||||||
struct ContextClosureLookupContext lookup_context = {
|
struct ContextClosureLookupContext lookup_context = {
|
||||||
{intersects_glyph},
|
{intersects_glyph},
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int count = ruleSet.len;
|
unsigned int count = ruleSet.len;
|
||||||
|
@ -1352,7 +1352,7 @@ struct ContextFormat1
|
||||||
|
|
||||||
struct ContextCollectGlyphsLookupContext lookup_context = {
|
struct ContextCollectGlyphsLookupContext lookup_context = {
|
||||||
{collect_glyph},
|
{collect_glyph},
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int count = ruleSet.len;
|
unsigned int count = ruleSet.len;
|
||||||
|
@ -1367,7 +1367,7 @@ struct ContextFormat1
|
||||||
const RuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
|
const RuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
|
||||||
struct ContextApplyLookupContext lookup_context = {
|
struct ContextApplyLookupContext lookup_context = {
|
||||||
{match_glyph},
|
{match_glyph},
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
return_trace (rule_set.would_apply (c, lookup_context));
|
return_trace (rule_set.would_apply (c, lookup_context));
|
||||||
}
|
}
|
||||||
|
@ -1387,7 +1387,7 @@ struct ContextFormat1
|
||||||
const RuleSet &rule_set = this+ruleSet[index];
|
const RuleSet &rule_set = this+ruleSet[index];
|
||||||
struct ContextApplyLookupContext lookup_context = {
|
struct ContextApplyLookupContext lookup_context = {
|
||||||
{match_glyph},
|
{match_glyph},
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
return_trace (rule_set.apply (c, lookup_context));
|
return_trace (rule_set.apply (c, lookup_context));
|
||||||
}
|
}
|
||||||
|
@ -1892,7 +1892,7 @@ struct ChainContextFormat1
|
||||||
|
|
||||||
struct ChainContextClosureLookupContext lookup_context = {
|
struct ChainContextClosureLookupContext lookup_context = {
|
||||||
{intersects_glyph},
|
{intersects_glyph},
|
||||||
{NULL, NULL, NULL}
|
{nullptr, nullptr, nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int count = ruleSet.len;
|
unsigned int count = ruleSet.len;
|
||||||
|
@ -1910,7 +1910,7 @@ struct ChainContextFormat1
|
||||||
|
|
||||||
struct ChainContextCollectGlyphsLookupContext lookup_context = {
|
struct ChainContextCollectGlyphsLookupContext lookup_context = {
|
||||||
{collect_glyph},
|
{collect_glyph},
|
||||||
{NULL, NULL, NULL}
|
{nullptr, nullptr, nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int count = ruleSet.len;
|
unsigned int count = ruleSet.len;
|
||||||
|
@ -1925,7 +1925,7 @@ struct ChainContextFormat1
|
||||||
const ChainRuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
|
const ChainRuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
|
||||||
struct ChainContextApplyLookupContext lookup_context = {
|
struct ChainContextApplyLookupContext lookup_context = {
|
||||||
{match_glyph},
|
{match_glyph},
|
||||||
{NULL, NULL, NULL}
|
{nullptr, nullptr, nullptr}
|
||||||
};
|
};
|
||||||
return_trace (rule_set.would_apply (c, lookup_context));
|
return_trace (rule_set.would_apply (c, lookup_context));
|
||||||
}
|
}
|
||||||
|
@ -1944,7 +1944,7 @@ struct ChainContextFormat1
|
||||||
const ChainRuleSet &rule_set = this+ruleSet[index];
|
const ChainRuleSet &rule_set = this+ruleSet[index];
|
||||||
struct ChainContextApplyLookupContext lookup_context = {
|
struct ChainContextApplyLookupContext lookup_context = {
|
||||||
{match_glyph},
|
{match_glyph},
|
||||||
{NULL, NULL, NULL}
|
{nullptr, nullptr, nullptr}
|
||||||
};
|
};
|
||||||
return_trace (rule_set.apply (c, lookup_context));
|
return_trace (rule_set.apply (c, lookup_context));
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ struct JstfPriority
|
||||||
struct JstfLangSys : OffsetListOf<JstfPriority>
|
struct JstfLangSys : OffsetListOf<JstfPriority>
|
||||||
{
|
{
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
const Record<JstfLangSys>::sanitize_closure_t * = NULL) const
|
const Record<JstfLangSys>::sanitize_closure_t * = nullptr) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (OffsetListOf<JstfPriority>::sanitize (c));
|
return_trace (OffsetListOf<JstfPriority>::sanitize (c));
|
||||||
|
@ -165,7 +165,7 @@ struct JstfScript
|
||||||
inline const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
inline const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c,
|
inline bool sanitize (hb_sanitize_context_t *c,
|
||||||
const Record<JstfScript>::sanitize_closure_t * = NULL) const
|
const Record<JstfScript>::sanitize_closure_t * = nullptr) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (extenderGlyphs.sanitize (c, this) &&
|
return_trace (extenderGlyphs.sanitize (c, this) &&
|
||||||
|
|
|
@ -44,7 +44,7 @@ _hb_ot_layout_create (hb_face_t *face)
|
||||||
{
|
{
|
||||||
hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
|
hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
|
||||||
if (unlikely (!layout))
|
if (unlikely (!layout))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
layout->gdef_blob = OT::Sanitizer<OT::GDEF>::sanitize (face->reference_table (HB_OT_TAG_GDEF));
|
layout->gdef_blob = OT::Sanitizer<OT::GDEF>::sanitize (face->reference_table (HB_OT_TAG_GDEF));
|
||||||
layout->gdef = OT::Sanitizer<OT::GDEF>::lock_instance (layout->gdef_blob);
|
layout->gdef = OT::Sanitizer<OT::GDEF>::lock_instance (layout->gdef_blob);
|
||||||
|
@ -176,7 +176,7 @@ _hb_ot_layout_create (hb_face_t *face)
|
||||||
(layout->gpos_lookup_count && !layout->gpos_accels)))
|
(layout->gpos_lookup_count && !layout->gpos_accels)))
|
||||||
{
|
{
|
||||||
_hb_ot_layout_destroy (layout);
|
_hb_ot_layout_destroy (layout);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
|
for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
|
||||||
|
@ -474,7 +474,7 @@ hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
|
||||||
script_index,
|
script_index,
|
||||||
language_index,
|
language_index,
|
||||||
feature_index,
|
feature_index,
|
||||||
NULL);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -652,7 +652,7 @@ _hb_ot_layout_collect_lookups_features (hb_face_t *face,
|
||||||
script_index,
|
script_index,
|
||||||
language_index,
|
language_index,
|
||||||
&required_feature_index,
|
&required_feature_index,
|
||||||
NULL))
|
nullptr))
|
||||||
_hb_ot_layout_collect_lookups_lookups (face,
|
_hb_ot_layout_collect_lookups_lookups (face,
|
||||||
table_tag,
|
table_tag,
|
||||||
required_feature_index,
|
required_feature_index,
|
||||||
|
@ -721,7 +721,7 @@ _hb_ot_layout_collect_lookups_languages (hb_face_t *face,
|
||||||
unsigned int count = hb_ot_layout_script_get_language_tags (face,
|
unsigned int count = hb_ot_layout_script_get_language_tags (face,
|
||||||
table_tag,
|
table_tag,
|
||||||
script_index,
|
script_index,
|
||||||
0, NULL, NULL);
|
0, nullptr, nullptr);
|
||||||
for (unsigned int language_index = 0; language_index < count; language_index++)
|
for (unsigned int language_index = 0; language_index < count; language_index++)
|
||||||
_hb_ot_layout_collect_lookups_features (face,
|
_hb_ot_layout_collect_lookups_features (face,
|
||||||
table_tag,
|
table_tag,
|
||||||
|
@ -768,7 +768,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face,
|
||||||
/* All scripts */
|
/* All scripts */
|
||||||
unsigned int count = hb_ot_layout_table_get_script_tags (face,
|
unsigned int count = hb_ot_layout_table_get_script_tags (face,
|
||||||
table_tag,
|
table_tag,
|
||||||
0, NULL, NULL);
|
0, nullptr, nullptr);
|
||||||
for (unsigned int script_index = 0; script_index < count; script_index++)
|
for (unsigned int script_index = 0; script_index < count; script_index++)
|
||||||
_hb_ot_layout_collect_lookups_languages (face,
|
_hb_ot_layout_collect_lookups_languages (face,
|
||||||
table_tag,
|
table_tag,
|
||||||
|
@ -805,10 +805,10 @@ void
|
||||||
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
|
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
|
||||||
hb_tag_t table_tag,
|
hb_tag_t table_tag,
|
||||||
unsigned int lookup_index,
|
unsigned int lookup_index,
|
||||||
hb_set_t *glyphs_before, /* OUT. May be NULL */
|
hb_set_t *glyphs_before, /* OUT. May be nullptr */
|
||||||
hb_set_t *glyphs_input, /* OUT. May be NULL */
|
hb_set_t *glyphs_input, /* OUT. May be nullptr */
|
||||||
hb_set_t *glyphs_after, /* OUT. May be NULL */
|
hb_set_t *glyphs_after, /* OUT. May be nullptr */
|
||||||
hb_set_t *glyphs_output /* OUT. May be NULL */)
|
hb_set_t *glyphs_output /* OUT. May be nullptr */)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
|
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
|
||||||
|
|
||||||
|
@ -967,11 +967,11 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
|
||||||
**/
|
**/
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_ot_layout_get_size_params (hb_face_t *face,
|
hb_ot_layout_get_size_params (hb_face_t *face,
|
||||||
unsigned int *design_size, /* OUT. May be NULL */
|
unsigned int *design_size, /* OUT. May be nullptr */
|
||||||
unsigned int *subfamily_id, /* OUT. May be NULL */
|
unsigned int *subfamily_id, /* OUT. May be nullptr */
|
||||||
unsigned int *subfamily_name_id, /* OUT. May be NULL */
|
unsigned int *subfamily_name_id, /* OUT. May be nullptr */
|
||||||
unsigned int *range_start, /* OUT. May be NULL */
|
unsigned int *range_start, /* OUT. May be nullptr */
|
||||||
unsigned int *range_end /* OUT. May be NULL */)
|
unsigned int *range_end /* OUT. May be nullptr */)
|
||||||
{
|
{
|
||||||
const OT::GPOS &gpos = _get_gpos (face);
|
const OT::GPOS &gpos = _get_gpos (face);
|
||||||
const hb_tag_t tag = HB_TAG ('s','i','z','e');
|
const hb_tag_t tag = HB_TAG ('s','i','z','e');
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct hb_ot_map_t
|
||||||
|
|
||||||
inline hb_mask_t get_global_mask (void) const { return global_mask; }
|
inline hb_mask_t get_global_mask (void) const { return global_mask; }
|
||||||
|
|
||||||
inline hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = NULL) const {
|
inline hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const {
|
||||||
const feature_map_t *map = features.bsearch (&feature_tag);
|
const feature_map_t *map = features.bsearch (&feature_tag);
|
||||||
if (shift) *shift = map ? map->shift : 0;
|
if (shift) *shift = map ? map->shift : 0;
|
||||||
return map ? map->mask : 0;
|
return map ? map->mask : 0;
|
||||||
|
@ -108,14 +108,14 @@ struct hb_ot_map_t
|
||||||
inline void get_stage_lookups (unsigned int table_index, unsigned int stage,
|
inline void get_stage_lookups (unsigned int table_index, unsigned int stage,
|
||||||
const struct lookup_map_t **plookups, unsigned int *lookup_count) const {
|
const struct lookup_map_t **plookups, unsigned int *lookup_count) const {
|
||||||
if (unlikely (stage == (unsigned int) -1)) {
|
if (unlikely (stage == (unsigned int) -1)) {
|
||||||
*plookups = NULL;
|
*plookups = nullptr;
|
||||||
*lookup_count = 0;
|
*lookup_count = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert (stage <= stages[table_index].len);
|
assert (stage <= stages[table_index].len);
|
||||||
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
|
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
|
||||||
unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].last_lookup : lookups[table_index].len;
|
unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].last_lookup : lookups[table_index].len;
|
||||||
*plookups = end == start ? NULL : &lookups[table_index][start];
|
*plookups = end == start ? nullptr : &lookups[table_index][start];
|
||||||
*lookup_count = end - start;
|
*lookup_count = end - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
|
||||||
feature_infos.shrink (0); /* Done with these */
|
feature_infos.shrink (0); /* Done with these */
|
||||||
|
|
||||||
|
|
||||||
add_gsub_pause (NULL);
|
add_gsub_pause (nullptr);
|
||||||
add_gpos_pause (NULL);
|
add_gpos_pause (nullptr);
|
||||||
|
|
||||||
for (unsigned int table_index = 0; table_index < 2; table_index++)
|
for (unsigned int table_index = 0; table_index < 2; table_index++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct MathValueRecord
|
||||||
protected:
|
protected:
|
||||||
SHORT value; /* The X or Y value in design units */
|
SHORT value; /* The X or Y value in design units */
|
||||||
OffsetTo<Device> deviceTable; /* Offset to the device table - from the
|
OffsetTo<Device> deviceTable; /* Offset to the device table - from the
|
||||||
* beginning of parent table. May be NULL.
|
* beginning of parent table. May be nullptr.
|
||||||
* Suggested format for device table is 1. */
|
* Suggested format for device table is 1. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -319,7 +319,7 @@ struct MathKernInfoRecord
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Offset to MathKern table for each corner -
|
/* Offset to MathKern table for each corner -
|
||||||
* from the beginning of MathKernInfo table. May be NULL. */
|
* from the beginning of MathKernInfo table. May be nullptr. */
|
||||||
OffsetTo<MathKern> mathKern[4];
|
OffsetTo<MathKern> mathKern[4];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -402,7 +402,7 @@ struct MathGlyphInfo
|
||||||
* from the beginning of MathGlyphInfo table. When the left or right glyph of
|
* from the beginning of MathGlyphInfo table. When the left or right glyph of
|
||||||
* a box is an extended shape variant, the (ink) box (and not the default
|
* a box is an extended shape variant, the (ink) box (and not the default
|
||||||
* position defined by values in MathConstants table) should be used for
|
* position defined by values in MathConstants table) should be used for
|
||||||
* vertical positioning purposes. May be NULL.. */
|
* vertical positioning purposes. May be nullptr.. */
|
||||||
OffsetTo<Coverage> extendedShapeCoverage;
|
OffsetTo<Coverage> extendedShapeCoverage;
|
||||||
|
|
||||||
/* Offset to MathKernInfo table -
|
/* Offset to MathKernInfo table -
|
||||||
|
@ -571,7 +571,7 @@ struct MathGlyphConstruction
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Offset to MathGlyphAssembly table for this shape - from the beginning of
|
/* Offset to MathGlyphAssembly table for this shape - from the beginning of
|
||||||
MathGlyphConstruction table. May be NULL. */
|
MathGlyphConstruction table. May be nullptr. */
|
||||||
OffsetTo<MathGlyphAssembly> glyphAssembly;
|
OffsetTo<MathGlyphAssembly> glyphAssembly;
|
||||||
|
|
||||||
/* MathGlyphVariantRecords for alternative variants of the glyphs. */
|
/* MathGlyphVariantRecords for alternative variants of the glyphs. */
|
||||||
|
|
|
@ -73,7 +73,7 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!num_glyphs)
|
if (!num_glyphs)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* Bubble-sort or something equally good!
|
/* Bubble-sort or something equally good!
|
||||||
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
|
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
|
||||||
|
@ -94,7 +94,7 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
|
||||||
c.end_serialize ();
|
c.end_serialize ();
|
||||||
/* TODO sanitize the results? */
|
/* TODO sanitize the results? */
|
||||||
|
|
||||||
return ret ? c.copy<OT::SubstLookup> () : NULL;
|
return ret ? c.copy<OT::SubstLookup> () : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static OT::SubstLookup *
|
static OT::SubstLookup *
|
||||||
|
@ -153,7 +153,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!num_ligatures)
|
if (!num_ligatures)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
OT::Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
|
OT::Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
|
||||||
OT::Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
|
OT::Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
|
||||||
|
@ -177,7 +177,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
|
||||||
c.end_serialize ();
|
c.end_serialize ();
|
||||||
/* TODO sanitize the results? */
|
/* TODO sanitize the results? */
|
||||||
|
|
||||||
return ret ? c.copy<OT::SubstLookup> () : NULL;
|
return ret ? c.copy<OT::SubstLookup> () : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static OT::SubstLookup *
|
static OT::SubstLookup *
|
||||||
|
|
|
@ -212,13 +212,13 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
|
||||||
map->add_global_bool_feature (HB_TAG('c','c','m','p'));
|
map->add_global_bool_feature (HB_TAG('c','c','m','p'));
|
||||||
map->add_global_bool_feature (HB_TAG('l','o','c','l'));
|
map->add_global_bool_feature (HB_TAG('l','o','c','l'));
|
||||||
|
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++)
|
for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++)
|
||||||
{
|
{
|
||||||
bool has_fallback = plan->props.script == HB_SCRIPT_ARABIC && !FEATURE_IS_SYRIAC (arabic_features[i]);
|
bool has_fallback = plan->props.script == HB_SCRIPT_ARABIC && !FEATURE_IS_SYRIAC (arabic_features[i]);
|
||||||
map->add_feature (arabic_features[i], 1, has_fallback ? F_HAS_FALLBACK : F_NONE);
|
map->add_feature (arabic_features[i], 1, has_fallback ? F_HAS_FALLBACK : F_NONE);
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
map->add_feature (HB_TAG('r','l','i','g'), 1, F_GLOBAL|F_HAS_FALLBACK);
|
map->add_feature (HB_TAG('r','l','i','g'), 1, F_GLOBAL|F_HAS_FALLBACK);
|
||||||
|
@ -228,7 +228,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
|
||||||
/* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */
|
/* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */
|
||||||
map->add_global_bool_feature (HB_TAG('r','c','l','t'));
|
map->add_global_bool_feature (HB_TAG('r','c','l','t'));
|
||||||
map->add_global_bool_feature (HB_TAG('c','a','l','t'));
|
map->add_global_bool_feature (HB_TAG('c','a','l','t'));
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
|
|
||||||
/* The spec includes 'cswh'. Earlier versions of Windows
|
/* The spec includes 'cswh'. Earlier versions of Windows
|
||||||
* used to enable this by default, but testing suggests
|
* used to enable this by default, but testing suggests
|
||||||
|
@ -265,7 +265,7 @@ data_create_arabic (const hb_ot_shape_plan_t *plan)
|
||||||
{
|
{
|
||||||
arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) calloc (1, sizeof (arabic_shape_plan_t));
|
arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) calloc (1, sizeof (arabic_shape_plan_t));
|
||||||
if (unlikely (!arabic_plan))
|
if (unlikely (!arabic_plan))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
|
arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
|
||||||
arabic_plan->has_stch = !!plan->map.get_1_mask (HB_TAG ('s','t','c','h'));
|
arabic_plan->has_stch = !!plan->map.get_1_mask (HB_TAG ('s','t','c','h'));
|
||||||
|
@ -412,7 +412,7 @@ retry:
|
||||||
{
|
{
|
||||||
/* This sucks. We need a font to build the fallback plan... */
|
/* This sucks. We need a font to build the fallback plan... */
|
||||||
fallback_plan = arabic_fallback_plan_create (plan, font);
|
fallback_plan = arabic_fallback_plan_create (plan, font);
|
||||||
if (unlikely (!hb_atomic_ptr_cmpexch (&(const_cast<arabic_shape_plan_t *> (arabic_plan))->fallback_plan, NULL, fallback_plan))) {
|
if (unlikely (!hb_atomic_ptr_cmpexch (&(const_cast<arabic_shape_plan_t *> (arabic_plan))->fallback_plan, nullptr, fallback_plan))) {
|
||||||
arabic_fallback_plan_destroy (fallback_plan);
|
arabic_fallback_plan_destroy (fallback_plan);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -532,11 +532,11 @@ apply_stch (const hb_ot_shape_plan_t *plan,
|
||||||
}
|
}
|
||||||
i++; // Don't touch i again.
|
i++; // Don't touch i again.
|
||||||
|
|
||||||
DEBUG_MSG (ARABIC, NULL, "%s stretch at (%d,%d,%d)",
|
DEBUG_MSG (ARABIC, nullptr, "%s stretch at (%d,%d,%d)",
|
||||||
step == MEASURE ? "measuring" : "cutting", context, start, end);
|
step == MEASURE ? "measuring" : "cutting", context, start, end);
|
||||||
DEBUG_MSG (ARABIC, NULL, "rest of word: count=%d width %d", start - context, w_total);
|
DEBUG_MSG (ARABIC, nullptr, "rest of word: count=%d width %d", start - context, w_total);
|
||||||
DEBUG_MSG (ARABIC, NULL, "fixed tiles: count=%d width=%d", n_fixed, w_fixed);
|
DEBUG_MSG (ARABIC, nullptr, "fixed tiles: count=%d width=%d", n_fixed, w_fixed);
|
||||||
DEBUG_MSG (ARABIC, NULL, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
|
DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
|
||||||
|
|
||||||
/* Number of additional times to repeat each repeating tile. */
|
/* Number of additional times to repeat each repeating tile. */
|
||||||
int n_copies = 0;
|
int n_copies = 0;
|
||||||
|
@ -559,7 +559,7 @@ apply_stch (const hb_ot_shape_plan_t *plan,
|
||||||
if (step == MEASURE)
|
if (step == MEASURE)
|
||||||
{
|
{
|
||||||
extra_glyphs_needed += n_copies * n_repeating;
|
extra_glyphs_needed += n_copies * n_repeating;
|
||||||
DEBUG_MSG (ARABIC, NULL, "will add extra %d copies of repeating tiles", n_copies);
|
DEBUG_MSG (ARABIC, nullptr, "will add extra %d copies of repeating tiles", n_copies);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -572,7 +572,7 @@ apply_stch (const hb_ot_shape_plan_t *plan,
|
||||||
if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
|
if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
|
||||||
repeat += n_copies;
|
repeat += n_copies;
|
||||||
|
|
||||||
DEBUG_MSG (ARABIC, NULL, "appending %d copies of glyph %d; j=%d",
|
DEBUG_MSG (ARABIC, nullptr, "appending %d copies of glyph %d; j=%d",
|
||||||
repeat, info[k - 1].codepoint, j);
|
repeat, info[k - 1].codepoint, j);
|
||||||
for (unsigned int n = 0; n < repeat; n++)
|
for (unsigned int n = 0; n < repeat; n++)
|
||||||
{
|
{
|
||||||
|
@ -691,16 +691,16 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
|
||||||
{
|
{
|
||||||
"arabic",
|
"arabic",
|
||||||
collect_features_arabic,
|
collect_features_arabic,
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
data_create_arabic,
|
data_create_arabic,
|
||||||
data_destroy_arabic,
|
data_destroy_arabic,
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
postprocess_glyphs_arabic,
|
postprocess_glyphs_arabic,
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
setup_masks_arabic,
|
setup_masks_arabic,
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
reorder_marks_arabic,
|
reorder_marks_arabic,
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||||
true, /* fallback_position */
|
true, /* fallback_position */
|
||||||
|
|
|
@ -30,18 +30,18 @@
|
||||||
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
|
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
|
||||||
{
|
{
|
||||||
"default",
|
"default",
|
||||||
NULL, /* collect_features */
|
nullptr, /* collect_features */
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
NULL, /* data_create */
|
nullptr, /* data_create */
|
||||||
NULL, /* data_destroy */
|
nullptr, /* data_destroy */
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
NULL, /* setup_masks */
|
nullptr, /* setup_masks */
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||||
true, /* fallback_position */
|
true, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ data_create_hangul (const hb_ot_shape_plan_t *plan)
|
||||||
{
|
{
|
||||||
hangul_shape_plan_t *hangul_plan = (hangul_shape_plan_t *) calloc (1, sizeof (hangul_shape_plan_t));
|
hangul_shape_plan_t *hangul_plan = (hangul_shape_plan_t *) calloc (1, sizeof (hangul_shape_plan_t));
|
||||||
if (unlikely (!hangul_plan))
|
if (unlikely (!hangul_plan))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < HANGUL_FEATURE_COUNT; i++)
|
for (unsigned int i = 0; i < HANGUL_FEATURE_COUNT; i++)
|
||||||
hangul_plan->mask_array[i] = plan->map.get_1_mask (hangul_features[i]);
|
hangul_plan->mask_array[i] = plan->map.get_1_mask (hangul_features[i]);
|
||||||
|
@ -420,13 +420,13 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul =
|
||||||
data_create_hangul,
|
data_create_hangul,
|
||||||
data_destroy_hangul,
|
data_destroy_hangul,
|
||||||
preprocess_text_hangul,
|
preprocess_text_hangul,
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
|
HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
setup_masks_hangul,
|
setup_masks_hangul,
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
||||||
false, /* fallback_position */
|
false, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -170,18 +170,18 @@ disable_otl_hebrew (const hb_ot_shape_plan_t *plan)
|
||||||
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
|
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
|
||||||
{
|
{
|
||||||
"hebrew",
|
"hebrew",
|
||||||
NULL, /* collect_features */
|
nullptr, /* collect_features */
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
NULL, /* data_create */
|
nullptr, /* data_create */
|
||||||
NULL, /* data_destroy */
|
nullptr, /* data_destroy */
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
compose_hebrew,
|
compose_hebrew,
|
||||||
NULL, /* setup_masks */
|
nullptr, /* setup_masks */
|
||||||
disable_otl_hebrew,
|
disable_otl_hebrew,
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||||
true, /* fallback_position */
|
true, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -435,7 +435,7 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
|
||||||
map->add_gsub_pause (initial_reordering);
|
map->add_gsub_pause (initial_reordering);
|
||||||
for (; i < INDIC_BASIC_FEATURES; i++) {
|
for (; i < INDIC_BASIC_FEATURES; i++) {
|
||||||
map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
|
map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
}
|
}
|
||||||
map->add_gsub_pause (final_reordering);
|
map->add_gsub_pause (final_reordering);
|
||||||
for (; i < INDIC_NUM_FEATURES; i++) {
|
for (; i < INDIC_NUM_FEATURES; i++) {
|
||||||
|
@ -533,7 +533,7 @@ data_create_indic (const hb_ot_shape_plan_t *plan)
|
||||||
{
|
{
|
||||||
indic_shape_plan_t *indic_plan = (indic_shape_plan_t *) calloc (1, sizeof (indic_shape_plan_t));
|
indic_shape_plan_t *indic_plan = (indic_shape_plan_t *) calloc (1, sizeof (indic_shape_plan_t));
|
||||||
if (unlikely (!indic_plan))
|
if (unlikely (!indic_plan))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
indic_plan->config = &indic_configs[0];
|
indic_plan->config = &indic_configs[0];
|
||||||
for (unsigned int i = 1; i < ARRAY_LENGTH (indic_configs); i++)
|
for (unsigned int i = 1; i < ARRAY_LENGTH (indic_configs); i++)
|
||||||
|
@ -1848,14 +1848,14 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
|
||||||
override_features_indic,
|
override_features_indic,
|
||||||
data_create_indic,
|
data_create_indic,
|
||||||
data_destroy_indic,
|
data_destroy_indic,
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
|
||||||
decompose_indic,
|
decompose_indic,
|
||||||
compose_indic,
|
compose_indic,
|
||||||
setup_masks_indic,
|
setup_masks_indic,
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
|
||||||
false, /* fallback_position */
|
false, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -103,7 +103,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
|
||||||
{
|
{
|
||||||
map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
|
map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
}
|
}
|
||||||
map->add_gsub_pause (final_reordering);
|
map->add_gsub_pause (final_reordering);
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
|
||||||
|
@ -513,18 +513,18 @@ final_reordering (const hb_ot_shape_plan_t *plan,
|
||||||
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
|
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
|
||||||
{
|
{
|
||||||
"default",
|
"default",
|
||||||
NULL, /* collect_features */
|
nullptr, /* collect_features */
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
NULL, /* data_create */
|
nullptr, /* data_create */
|
||||||
NULL, /* data_destroy */
|
nullptr, /* data_destroy */
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
NULL, /* setup_masks */
|
nullptr, /* setup_masks */
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||||
true, /* fallback_position */
|
true, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
@ -534,16 +534,16 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
|
||||||
"myanmar",
|
"myanmar",
|
||||||
collect_features_myanmar,
|
collect_features_myanmar,
|
||||||
override_features_myanmar,
|
override_features_myanmar,
|
||||||
NULL, /* data_create */
|
nullptr, /* data_create */
|
||||||
NULL, /* data_destroy */
|
nullptr, /* data_destroy */
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
setup_masks_myanmar,
|
setup_masks_myanmar,
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
|
||||||
false, /* fallback_position */
|
false, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,7 +70,7 @@ struct hb_ot_complex_shaper_t
|
||||||
/* collect_features()
|
/* collect_features()
|
||||||
* Called during shape_plan().
|
* Called during shape_plan().
|
||||||
* Shapers should use plan->map to add their features and callbacks.
|
* Shapers should use plan->map to add their features and callbacks.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*collect_features) (hb_ot_shape_planner_t *plan);
|
void (*collect_features) (hb_ot_shape_planner_t *plan);
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ struct hb_ot_complex_shaper_t
|
||||||
* Called during shape_plan().
|
* Called during shape_plan().
|
||||||
* Shapers should use plan->map to override features and add callbacks after
|
* Shapers should use plan->map to override features and add callbacks after
|
||||||
* common features are added.
|
* common features are added.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*override_features) (hb_ot_shape_planner_t *plan);
|
void (*override_features) (hb_ot_shape_planner_t *plan);
|
||||||
|
|
||||||
|
@ -86,15 +86,15 @@ struct hb_ot_complex_shaper_t
|
||||||
/* data_create()
|
/* data_create()
|
||||||
* Called at the end of shape_plan().
|
* Called at the end of shape_plan().
|
||||||
* Whatever shapers return will be accessible through plan->data later.
|
* Whatever shapers return will be accessible through plan->data later.
|
||||||
* If NULL is returned, means a plan failure.
|
* If nullptr is returned, means a plan failure.
|
||||||
*/
|
*/
|
||||||
void *(*data_create) (const hb_ot_shape_plan_t *plan);
|
void *(*data_create) (const hb_ot_shape_plan_t *plan);
|
||||||
|
|
||||||
/* data_destroy()
|
/* data_destroy()
|
||||||
* Called when the shape_plan is being destroyed.
|
* Called when the shape_plan is being destroyed.
|
||||||
* plan->data is passed here for destruction.
|
* plan->data is passed here for destruction.
|
||||||
* If NULL is returned, means a plan failure.
|
* If nullptr is returned, means a plan failure.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*data_destroy) (void *data);
|
void (*data_destroy) (void *data);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ struct hb_ot_complex_shaper_t
|
||||||
/* preprocess_text()
|
/* preprocess_text()
|
||||||
* Called during shape().
|
* Called during shape().
|
||||||
* Shapers can use to modify text before shaping starts.
|
* Shapers can use to modify text before shaping starts.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
|
void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
|
@ -111,7 +111,7 @@ struct hb_ot_complex_shaper_t
|
||||||
/* postprocess_glyphs()
|
/* postprocess_glyphs()
|
||||||
* Called during shape().
|
* Called during shape().
|
||||||
* Shapers can use to modify glyphs after shaping ends.
|
* Shapers can use to modify glyphs after shaping ends.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
|
void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
|
@ -122,7 +122,7 @@ struct hb_ot_complex_shaper_t
|
||||||
|
|
||||||
/* decompose()
|
/* decompose()
|
||||||
* Called during shape()'s normalization.
|
* Called during shape()'s normalization.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
|
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
|
||||||
hb_codepoint_t ab,
|
hb_codepoint_t ab,
|
||||||
|
@ -131,7 +131,7 @@ struct hb_ot_complex_shaper_t
|
||||||
|
|
||||||
/* compose()
|
/* compose()
|
||||||
* Called during shape()'s normalization.
|
* Called during shape()'s normalization.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
bool (*compose) (const hb_ot_shape_normalize_context_t *c,
|
bool (*compose) (const hb_ot_shape_normalize_context_t *c,
|
||||||
hb_codepoint_t a,
|
hb_codepoint_t a,
|
||||||
|
@ -142,7 +142,7 @@ struct hb_ot_complex_shaper_t
|
||||||
* Called during shape().
|
* Called during shape().
|
||||||
* Shapers should use map to get feature masks and set on buffer.
|
* Shapers should use map to get feature masks and set on buffer.
|
||||||
* Shapers may NOT modify characters.
|
* Shapers may NOT modify characters.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*setup_masks) (const hb_ot_shape_plan_t *plan,
|
void (*setup_masks) (const hb_ot_shape_plan_t *plan,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
|
@ -152,14 +152,14 @@ struct hb_ot_complex_shaper_t
|
||||||
* Called during shape().
|
* Called during shape().
|
||||||
* If set and returns true, GDEF/GSUB/GPOS of the font are ignored
|
* If set and returns true, GDEF/GSUB/GPOS of the font are ignored
|
||||||
* and fallback operations used.
|
* and fallback operations used.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
bool (*disable_otl) (const hb_ot_shape_plan_t *plan);
|
bool (*disable_otl) (const hb_ot_shape_plan_t *plan);
|
||||||
|
|
||||||
/* reorder_marks()
|
/* reorder_marks()
|
||||||
* Called during shape().
|
* Called during shape().
|
||||||
* Shapers can use to modify ordering of combining marks.
|
* Shapers can use to modify ordering of combining marks.
|
||||||
* May be NULL.
|
* May be nullptr.
|
||||||
*/
|
*/
|
||||||
void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
|
void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
|
@ -286,7 +286,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
|
||||||
planner->map.script_index[0],
|
planner->map.script_index[0],
|
||||||
planner->map.language_index[0],
|
planner->map.language_index[0],
|
||||||
HB_TAG ('p','r','e','f'),
|
HB_TAG ('p','r','e','f'),
|
||||||
NULL))
|
nullptr))
|
||||||
return &_hb_ot_complex_shaper_indic;
|
return &_hb_ot_complex_shaper_indic;
|
||||||
else
|
else
|
||||||
return &_hb_ot_complex_shaper_default;
|
return &_hb_ot_complex_shaper_default;
|
||||||
|
|
|
@ -97,7 +97,7 @@ thai_pua_shape (hb_codepoint_t u, thai_action_t action, hb_font_t *font)
|
||||||
hb_codepoint_t u;
|
hb_codepoint_t u;
|
||||||
hb_codepoint_t win_pua;
|
hb_codepoint_t win_pua;
|
||||||
hb_codepoint_t mac_pua;
|
hb_codepoint_t mac_pua;
|
||||||
} const *pua_mappings = NULL;
|
} const *pua_mappings = nullptr;
|
||||||
static const thai_pua_mapping_t SD_mappings[] = {
|
static const thai_pua_mapping_t SD_mappings[] = {
|
||||||
{0x0E48u, 0xF70Au, 0xF88Bu}, /* MAI EK */
|
{0x0E48u, 0xF70Au, 0xF88Bu}, /* MAI EK */
|
||||||
{0x0E49u, 0xF70Bu, 0xF88Eu}, /* MAI THO */
|
{0x0E49u, 0xF70Bu, 0xF88Eu}, /* MAI THO */
|
||||||
|
@ -367,18 +367,18 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
|
||||||
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
|
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
|
||||||
{
|
{
|
||||||
"thai",
|
"thai",
|
||||||
NULL, /* collect_features */
|
nullptr, /* collect_features */
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
NULL, /* data_create */
|
nullptr, /* data_create */
|
||||||
NULL, /* data_destroy */
|
nullptr, /* data_destroy */
|
||||||
preprocess_text_thai,
|
preprocess_text_thai,
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
NULL, /* setup_masks */
|
nullptr, /* setup_masks */
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||||
false,/* fallback_position */
|
false,/* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,17 +48,17 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan =
|
||||||
{
|
{
|
||||||
"default",
|
"default",
|
||||||
collect_features_tibetan,
|
collect_features_tibetan,
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
NULL, /* data_create */
|
nullptr, /* data_create */
|
||||||
NULL, /* data_destroy */
|
nullptr, /* data_destroy */
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
|
||||||
NULL, /* decompose */
|
nullptr, /* decompose */
|
||||||
NULL, /* compose */
|
nullptr, /* compose */
|
||||||
NULL, /* setup_masks */
|
nullptr, /* setup_masks */
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
|
||||||
true, /* fallback_position */
|
true, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -144,7 +144,7 @@ collect_features_use (hb_ot_shape_planner_t *plan)
|
||||||
/* "Topographical features" */
|
/* "Topographical features" */
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++)
|
||||||
map->add_feature (arabic_features[i], 1, F_NONE);
|
map->add_feature (arabic_features[i], 1, F_NONE);
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
|
|
||||||
/* "Standard typographic presentation" and "Positional feature application" */
|
/* "Standard typographic presentation" and "Positional feature application" */
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
|
||||||
|
@ -199,7 +199,7 @@ data_create_use (const hb_ot_shape_plan_t *plan)
|
||||||
{
|
{
|
||||||
use_shape_plan_t *use_plan = (use_shape_plan_t *) calloc (1, sizeof (use_shape_plan_t));
|
use_shape_plan_t *use_plan = (use_shape_plan_t *) calloc (1, sizeof (use_shape_plan_t));
|
||||||
if (unlikely (!use_plan))
|
if (unlikely (!use_plan))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
use_plan->rphf_mask = plan->map.get_1_mask (HB_TAG('r','p','h','f'));
|
use_plan->rphf_mask = plan->map.get_1_mask (HB_TAG('r','p','h','f'));
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ data_create_use (const hb_ot_shape_plan_t *plan)
|
||||||
if (unlikely (!use_plan->arabic_plan))
|
if (unlikely (!use_plan->arabic_plan))
|
||||||
{
|
{
|
||||||
free (use_plan);
|
free (use_plan);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,17 +597,17 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use =
|
||||||
{
|
{
|
||||||
"use",
|
"use",
|
||||||
collect_features_use,
|
collect_features_use,
|
||||||
NULL, /* override_features */
|
nullptr, /* override_features */
|
||||||
data_create_use,
|
data_create_use,
|
||||||
data_destroy_use,
|
data_destroy_use,
|
||||||
NULL, /* preprocess_text */
|
nullptr, /* preprocess_text */
|
||||||
NULL, /* postprocess_glyphs */
|
nullptr, /* postprocess_glyphs */
|
||||||
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
|
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
|
||||||
decompose_use,
|
decompose_use,
|
||||||
compose_use,
|
compose_use,
|
||||||
setup_masks_use,
|
setup_masks_use,
|
||||||
NULL, /* disable_otl */
|
nullptr, /* disable_otl */
|
||||||
NULL, /* reorder_marks */
|
nullptr, /* reorder_marks */
|
||||||
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
|
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
|
||||||
false, /* fallback_position */
|
false, /* fallback_position */
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct hb_ot_shape_planner_t
|
||||||
hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) :
|
hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) :
|
||||||
face (master_plan->face_unsafe),
|
face (master_plan->face_unsafe),
|
||||||
props (master_plan->props),
|
props (master_plan->props),
|
||||||
shaper (NULL),
|
shaper (nullptr),
|
||||||
map (face, &props) {}
|
map (face, &props) {}
|
||||||
~hb_ot_shape_planner_t (void) { map.finish (); }
|
~hb_ot_shape_planner_t (void) { map.finish (); }
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
||||||
hb_ot_map_builder_t *map = &planner->map;
|
hb_ot_map_builder_t *map = &planner->map;
|
||||||
|
|
||||||
map->add_global_bool_feature (HB_TAG('r','v','r','n'));
|
map->add_global_bool_feature (HB_TAG('r','v','r','n'));
|
||||||
map->add_gsub_pause (NULL);
|
map->add_gsub_pause (nullptr);
|
||||||
|
|
||||||
switch (props->direction) {
|
switch (props->direction) {
|
||||||
case HB_DIRECTION_LTR:
|
case HB_DIRECTION_LTR:
|
||||||
|
@ -176,7 +176,7 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
|
||||||
{
|
{
|
||||||
hb_ot_shape_plan_t *plan = (hb_ot_shape_plan_t *) calloc (1, sizeof (hb_ot_shape_plan_t));
|
hb_ot_shape_plan_t *plan = (hb_ot_shape_plan_t *) calloc (1, sizeof (hb_ot_shape_plan_t));
|
||||||
if (unlikely (!plan))
|
if (unlikely (!plan))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
hb_ot_shape_planner_t planner (shape_plan);
|
hb_ot_shape_planner_t planner (shape_plan);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
|
||||||
if (plan->shaper->data_create) {
|
if (plan->shaper->data_create) {
|
||||||
plan->data = plan->shaper->data_create (plan);
|
plan->data = plan->shaper->data_create (plan);
|
||||||
if (unlikely (!plan->data))
|
if (unlikely (!plan->data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return plan;
|
return plan;
|
||||||
|
@ -928,7 +928,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
|
||||||
{
|
{
|
||||||
hb_ot_shape_plan_t plan;
|
hb_ot_shape_plan_t plan;
|
||||||
|
|
||||||
const char *shapers[] = {"ot", NULL};
|
const char *shapers[] = {"ot", nullptr};
|
||||||
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
|
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
|
||||||
features, num_features, shapers);
|
features, num_features, shapers);
|
||||||
|
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ hb_ot_tag_to_language (hb_tag_t tag)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (tag == HB_OT_TAG_DEFAULT_LANGUAGE)
|
if (tag == HB_OT_TAG_DEFAULT_LANGUAGE)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* struct LangTag has only room for 3-letter language tags. */
|
/* struct LangTag has only room for 3-letter language tags. */
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ hb_ot_var_normalize_variations (hb_face_t *face,
|
||||||
for (unsigned int i = 0; i < variations_length; i++)
|
for (unsigned int i = 0; i < variations_length; i++)
|
||||||
{
|
{
|
||||||
unsigned int axis_index;
|
unsigned int axis_index;
|
||||||
if (hb_ot_var_find_axis (face, variations[i].tag, &axis_index, NULL) &&
|
if (hb_ot_var_find_axis (face, variations[i].tag, &axis_index, nullptr) &&
|
||||||
axis_index < coords_length)
|
axis_index < coords_length)
|
||||||
coords[axis_index] = fvar.normalize_axis_value (axis_index, variations[i].value);
|
coords[axis_index] = fvar.normalize_axis_value (axis_index, variations[i].value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,13 +200,13 @@ private:
|
||||||
# if defined(_WIN32_WCE)
|
# if defined(_WIN32_WCE)
|
||||||
/* Some things not defined on Windows CE. */
|
/* Some things not defined on Windows CE. */
|
||||||
# define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
# define getenv(Name) NULL
|
# define getenv(Name) nullptr
|
||||||
# if _WIN32_WCE < 0x800
|
# if _WIN32_WCE < 0x800
|
||||||
# define setlocale(Category, Locale) "C"
|
# define setlocale(Category, Locale) "C"
|
||||||
static int errno = 0; /* Use something better? */
|
static int errno = 0; /* Use something better? */
|
||||||
# endif
|
# endif
|
||||||
# elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
|
# elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
|
||||||
# define getenv(Name) NULL
|
# define getenv(Name) nullptr
|
||||||
# endif
|
# endif
|
||||||
# if defined(_MSC_VER) && _MSC_VER < 1900
|
# if defined(_MSC_VER) && _MSC_VER < 1900
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
@ -241,11 +241,6 @@ static int errno = 0; /* Use something better? */
|
||||||
|
|
||||||
/* Basics */
|
/* Basics */
|
||||||
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
# define NULL ((void *) 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef MIN
|
#undef MIN
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
|
static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
|
||||||
|
@ -321,7 +316,7 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
|
||||||
/* Void! */
|
/* Void! */
|
||||||
struct _hb_void_t {};
|
struct _hb_void_t {};
|
||||||
typedef const _hb_void_t *hb_void_t;
|
typedef const _hb_void_t *hb_void_t;
|
||||||
#define HB_VOID ((const _hb_void_t *) NULL)
|
#define HB_VOID ((const _hb_void_t *) nullptr)
|
||||||
|
|
||||||
/* Return the number of 1 bits in mask. */
|
/* Return the number of 1 bits in mask. */
|
||||||
static inline HB_CONST_FUNC unsigned int
|
static inline HB_CONST_FUNC unsigned int
|
||||||
|
@ -387,7 +382,7 @@ typedef int (*hb_compare_func_t) (const void *, const void *);
|
||||||
/* arrays and maps */
|
/* arrays and maps */
|
||||||
|
|
||||||
|
|
||||||
#define HB_PREALLOCED_ARRAY_INIT {0, 0, NULL}
|
#define HB_PREALLOCED_ARRAY_INIT {0, 0, nullptr}
|
||||||
template <typename Type, unsigned int StaticSize=16>
|
template <typename Type, unsigned int StaticSize=16>
|
||||||
struct hb_prealloced_array_t
|
struct hb_prealloced_array_t
|
||||||
{
|
{
|
||||||
|
@ -412,7 +407,7 @@ struct hb_prealloced_array_t
|
||||||
|
|
||||||
/* Need to reallocate */
|
/* Need to reallocate */
|
||||||
unsigned int new_allocated = allocated + (allocated >> 1) + 8;
|
unsigned int new_allocated = allocated + (allocated >> 1) + 8;
|
||||||
Type *new_array = NULL;
|
Type *new_array = nullptr;
|
||||||
|
|
||||||
if (array == static_array) {
|
if (array == static_array) {
|
||||||
new_array = (Type *) calloc (new_allocated, sizeof (Type));
|
new_array = (Type *) calloc (new_allocated, sizeof (Type));
|
||||||
|
@ -426,7 +421,7 @@ struct hb_prealloced_array_t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely (!new_array))
|
if (unlikely (!new_array))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
array = new_array;
|
array = new_array;
|
||||||
allocated = new_allocated;
|
allocated = new_allocated;
|
||||||
|
@ -459,14 +454,14 @@ struct hb_prealloced_array_t
|
||||||
for (unsigned int i = 0; i < len; i++)
|
for (unsigned int i = 0; i < len; i++)
|
||||||
if (array[i] == v)
|
if (array[i] == v)
|
||||||
return &array[i];
|
return &array[i];
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const Type *find (T v) const {
|
inline const Type *find (T v) const {
|
||||||
for (unsigned int i = 0; i < len; i++)
|
for (unsigned int i = 0; i < len; i++)
|
||||||
if (array[i] == v)
|
if (array[i] == v)
|
||||||
return &array[i];
|
return &array[i];
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void qsort (void)
|
inline void qsort (void)
|
||||||
|
@ -494,7 +489,7 @@ struct hb_prealloced_array_t
|
||||||
{
|
{
|
||||||
if (array != static_array)
|
if (array != static_array)
|
||||||
free (array);
|
free (array);
|
||||||
array = NULL;
|
array = nullptr;
|
||||||
allocated = len = 0;
|
allocated = len = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -528,7 +523,7 @@ struct hb_lockable_set_t
|
||||||
old.finish ();
|
old.finish ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item = NULL;
|
item = nullptr;
|
||||||
l.unlock ();
|
l.unlock ();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -791,8 +786,8 @@ _hb_debug_msg<0> (const char *what HB_UNUSED,
|
||||||
const char *message HB_UNUSED,
|
const char *message HB_UNUSED,
|
||||||
...) {}
|
...) {}
|
||||||
|
|
||||||
#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, true, (LEVEL), (LEVEL_DIR), __VA_ARGS__)
|
#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), nullptr, true, (LEVEL), (LEVEL_DIR), __VA_ARGS__)
|
||||||
#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, false, 0, 0, __VA_ARGS__)
|
#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), nullptr, false, 0, 0, __VA_ARGS__)
|
||||||
#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__)
|
#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -851,7 +846,7 @@ struct hb_auto_trace_t {
|
||||||
{
|
{
|
||||||
_hb_warn_no_return<ret_t> (returned);
|
_hb_warn_no_return<ret_t> (returned);
|
||||||
if (!returned) {
|
if (!returned) {
|
||||||
_hb_debug_msg<max_level> (what, obj, NULL, true, plevel ? *plevel : 1, -1, " ");
|
_hb_debug_msg<max_level> (what, obj, nullptr, true, plevel ? *plevel : 1, -1, " ");
|
||||||
}
|
}
|
||||||
if (plevel) --*plevel;
|
if (plevel) --*plevel;
|
||||||
}
|
}
|
||||||
|
@ -863,11 +858,11 @@ struct hb_auto_trace_t {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
_hb_debug_msg<max_level> (what, obj, NULL, true, plevel ? *plevel : 1, -1,
|
_hb_debug_msg<max_level> (what, obj, nullptr, true, plevel ? *plevel : 1, -1,
|
||||||
"return %s (line %d)",
|
"return %s (line %d)",
|
||||||
hb_printer_t<ret_t>().print (v), line);
|
hb_printer_t<ret_t>().print (v), line);
|
||||||
if (plevel) --*plevel;
|
if (plevel) --*plevel;
|
||||||
plevel = NULL;
|
plevel = nullptr;
|
||||||
returned = true;
|
returned = true;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -989,7 +984,7 @@ hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *),
|
||||||
template <typename T> static inline void
|
template <typename T> static inline void
|
||||||
hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *))
|
hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *))
|
||||||
{
|
{
|
||||||
hb_stable_sort (array, len, compar, (int *) NULL);
|
hb_stable_sort (array, len, compar, (int *) nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline hb_bool_t
|
static inline hb_bool_t
|
||||||
|
|
|
@ -355,7 +355,7 @@ struct hb_frozen_set_t
|
||||||
inline void init (const hb_set_t &set)
|
inline void init (const hb_set_t &set)
|
||||||
{
|
{
|
||||||
start = count = 0;
|
start = count = 0;
|
||||||
elts = NULL;
|
elts = nullptr;
|
||||||
|
|
||||||
unsigned int max = set.get_max ();
|
unsigned int max = set.get_max ();
|
||||||
if (max == set.INVALID)
|
if (max == set.INVALID)
|
||||||
|
|
|
@ -115,7 +115,7 @@ hb_shape_plan_create (hb_face_t *face,
|
||||||
{
|
{
|
||||||
return hb_shape_plan_create2 (face, props,
|
return hb_shape_plan_create2 (face, props,
|
||||||
user_features, num_user_features,
|
user_features, num_user_features,
|
||||||
NULL, 0,
|
nullptr, 0,
|
||||||
shaper_list);
|
shaper_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ hb_shape_plan_create2 (hb_face_t *face,
|
||||||
unsigned int num_coords,
|
unsigned int num_coords,
|
||||||
const char * const *shaper_list)
|
const char * const *shaper_list)
|
||||||
{
|
{
|
||||||
DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
|
DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
|
||||||
"face=%p num_features=%d num_coords=%d shaper_list=%p",
|
"face=%p num_features=%d num_coords=%d shaper_list=%p",
|
||||||
face,
|
face,
|
||||||
num_user_features,
|
num_user_features,
|
||||||
|
@ -136,8 +136,8 @@ hb_shape_plan_create2 (hb_face_t *face,
|
||||||
shaper_list);
|
shaper_list);
|
||||||
|
|
||||||
hb_shape_plan_t *shape_plan;
|
hb_shape_plan_t *shape_plan;
|
||||||
hb_feature_t *features = NULL;
|
hb_feature_t *features = nullptr;
|
||||||
int *coords = NULL;
|
int *coords = nullptr;
|
||||||
|
|
||||||
if (unlikely (!face))
|
if (unlikely (!face))
|
||||||
face = hb_face_get_empty ();
|
face = hb_face_get_empty ();
|
||||||
|
@ -196,16 +196,16 @@ hb_shape_plan_get_empty (void)
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
true, /* default_shaper_list */
|
true, /* default_shaper_list */
|
||||||
NULL, /* face */
|
nullptr, /* face */
|
||||||
HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
|
HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
|
||||||
|
|
||||||
NULL, /* shaper_func */
|
nullptr, /* shaper_func */
|
||||||
NULL, /* shaper_name */
|
nullptr, /* shaper_name */
|
||||||
|
|
||||||
NULL, /* user_features */
|
nullptr, /* user_features */
|
||||||
0, /* num_user_featurs */
|
0, /* num_user_featurs */
|
||||||
|
|
||||||
NULL, /* coords */
|
nullptr, /* coords */
|
||||||
0, /* num_coords */
|
0, /* num_coords */
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -470,7 +470,7 @@ hb_shape_plan_create_cached (hb_face_t *face,
|
||||||
{
|
{
|
||||||
return hb_shape_plan_create_cached2 (face, props,
|
return hb_shape_plan_create_cached2 (face, props,
|
||||||
user_features, num_user_features,
|
user_features, num_user_features,
|
||||||
NULL, 0,
|
nullptr, 0,
|
||||||
shaper_list);
|
shaper_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
|
||||||
unsigned int num_coords,
|
unsigned int num_coords,
|
||||||
const char * const *shaper_list)
|
const char * const *shaper_list)
|
||||||
{
|
{
|
||||||
DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
|
DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
|
||||||
"face=%p num_features=%d shaper_list=%p",
|
"face=%p num_features=%d shaper_list=%p",
|
||||||
face,
|
face,
|
||||||
num_user_features,
|
num_user_features,
|
||||||
|
@ -494,7 +494,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
|
||||||
shaper_list,
|
shaper_list,
|
||||||
user_features,
|
user_features,
|
||||||
num_user_features,
|
num_user_features,
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
if (shaper_list) {
|
if (shaper_list) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ retry:
|
||||||
/* Not found; allocate one. */
|
/* Not found; allocate one. */
|
||||||
shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
|
shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
|
||||||
if (unlikely (!shaper_list)) {
|
if (unlikely (!shaper_list)) {
|
||||||
static const char *nil_shaper_list[] = {NULL};
|
static const char *nil_shaper_list[] = {nullptr};
|
||||||
return nil_shaper_list;
|
return nil_shaper_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +84,9 @@ retry:
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < HB_SHAPERS_COUNT; i++)
|
for (i = 0; i < HB_SHAPERS_COUNT; i++)
|
||||||
shaper_list[i] = shapers[i].name;
|
shaper_list[i] = shapers[i].name;
|
||||||
shaper_list[i] = NULL;
|
shaper_list[i] = nullptr;
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&static_shaper_list, NULL, shaper_list)) {
|
if (!hb_atomic_ptr_cmpexch (&static_shaper_list, nullptr, shaper_list)) {
|
||||||
free (shaper_list);
|
free (shaper_list);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -157,5 +157,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);
|
hb_shape_full (font, buffer, features, num_features, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
|
||||||
/* Drop and recreate. */ \
|
/* Drop and recreate. */ \
|
||||||
/* If someone dropped it in the mean time, throw it away and don't touch it. \
|
/* If someone dropped it in the mean time, throw it away and don't touch it. \
|
||||||
* Otherwise, destruct it. */ \
|
* Otherwise, destruct it. */ \
|
||||||
if (hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), data, NULL)) { \
|
if (hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), data, nullptr)) { \
|
||||||
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \
|
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \
|
||||||
} \
|
} \
|
||||||
goto retry; \
|
goto retry; \
|
||||||
|
@ -109,7 +109,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
|
||||||
data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \
|
data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \
|
||||||
if (unlikely (!data)) \
|
if (unlikely (!data)) \
|
||||||
data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \
|
data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \
|
||||||
if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) { \
|
if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), nullptr, data)) { \
|
||||||
if (data && \
|
if (data && \
|
||||||
data != HB_SHAPER_DATA_INVALID && \
|
data != HB_SHAPER_DATA_INVALID && \
|
||||||
data != HB_SHAPER_DATA_SUCCEEDED) \
|
data != HB_SHAPER_DATA_SUCCEEDED) \
|
||||||
|
@ -117,7 +117,7 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
|
||||||
goto retry; \
|
goto retry; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
return data != NULL && !HB_SHAPER_DATA_IS_INVALID (data); \
|
return data != nullptr && !HB_SHAPER_DATA_IS_INVALID (data); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,14 +59,14 @@ retry:
|
||||||
{
|
{
|
||||||
char *env = getenv ("HB_SHAPER_LIST");
|
char *env = getenv ("HB_SHAPER_LIST");
|
||||||
if (!env || !*env) {
|
if (!env || !*env) {
|
||||||
(void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
|
(void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
|
||||||
return (const hb_shaper_pair_t *) all_shapers;
|
return (const hb_shaper_pair_t *) all_shapers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not found; allocate one. */
|
/* Not found; allocate one. */
|
||||||
shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
|
shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
|
||||||
if (unlikely (!shapers)) {
|
if (unlikely (!shapers)) {
|
||||||
(void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
|
(void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
|
||||||
return (const hb_shaper_pair_t *) all_shapers;
|
return (const hb_shaper_pair_t *) all_shapers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ retry:
|
||||||
p = end + 1;
|
p = end + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&static_shapers, NULL, shapers)) {
|
if (!hb_atomic_ptr_cmpexch (&static_shapers, nullptr, shapers)) {
|
||||||
free (shapers);
|
free (shapers);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ hb_ucdn_get_unicode_funcs (void)
|
||||||
static const hb_unicode_funcs_t _hb_ucdn_unicode_funcs = {
|
static const hb_unicode_funcs_t _hb_ucdn_unicode_funcs = {
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
NULL, /* parent */
|
nullptr, /* parent */
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
{
|
{
|
||||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_ucdn_##name,
|
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_ucdn_##name,
|
||||||
|
|
|
@ -188,7 +188,7 @@ hb_unicode_funcs_create (hb_unicode_funcs_t *parent)
|
||||||
const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
|
const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
|
||||||
HB_OBJECT_HEADER_STATIC,
|
HB_OBJECT_HEADER_STATIC,
|
||||||
|
|
||||||
NULL, /* parent */
|
nullptr, /* parent */
|
||||||
true, /* immutable */
|
true, /* immutable */
|
||||||
{
|
{
|
||||||
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
|
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
|
||||||
|
@ -365,7 +365,7 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
|
||||||
} else { \
|
} else { \
|
||||||
ufuncs->func.name = ufuncs->parent->func.name; \
|
ufuncs->func.name = ufuncs->parent->func.name; \
|
||||||
ufuncs->user_data.name = ufuncs->parent->user_data.name; \
|
ufuncs->user_data.name = ufuncs->parent->user_data.name; \
|
||||||
ufuncs->destroy.name = NULL; \
|
ufuncs->destroy.name = nullptr; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,9 +202,9 @@ struct hb_uniscribe_shaper_funcs_t {
|
||||||
inline void init (void)
|
inline void init (void)
|
||||||
{
|
{
|
||||||
HMODULE hinstLib;
|
HMODULE hinstLib;
|
||||||
this->ScriptItemizeOpenType = NULL;
|
this->ScriptItemizeOpenType = nullptr;
|
||||||
this->ScriptShapeOpenType = NULL;
|
this->ScriptShapeOpenType = nullptr;
|
||||||
this->ScriptPlaceOpenType = NULL;
|
this->ScriptPlaceOpenType = nullptr;
|
||||||
|
|
||||||
hinstLib = GetModuleHandle (TEXT ("usp10.dll"));
|
hinstLib = GetModuleHandle (TEXT ("usp10.dll"));
|
||||||
if (hinstLib)
|
if (hinstLib)
|
||||||
|
@ -217,7 +217,7 @@ struct hb_uniscribe_shaper_funcs_t {
|
||||||
!this->ScriptShapeOpenType ||
|
!this->ScriptShapeOpenType ||
|
||||||
!this->ScriptPlaceOpenType)
|
!this->ScriptPlaceOpenType)
|
||||||
{
|
{
|
||||||
DEBUG_MSG (UNISCRIBE, NULL, "OpenType versions of functions not found; falling back.");
|
DEBUG_MSG (UNISCRIBE, nullptr, "OpenType versions of functions not found; falling back.");
|
||||||
this->ScriptItemizeOpenType = hb_ScriptItemizeOpenType;
|
this->ScriptItemizeOpenType = hb_ScriptItemizeOpenType;
|
||||||
this->ScriptShapeOpenType = hb_ScriptShapeOpenType;
|
this->ScriptShapeOpenType = hb_ScriptShapeOpenType;
|
||||||
this->ScriptPlaceOpenType = hb_ScriptPlaceOpenType;
|
this->ScriptPlaceOpenType = hb_ScriptPlaceOpenType;
|
||||||
|
@ -242,11 +242,11 @@ retry:
|
||||||
{
|
{
|
||||||
funcs = (hb_uniscribe_shaper_funcs_t *) calloc (1, sizeof (hb_uniscribe_shaper_funcs_t));
|
funcs = (hb_uniscribe_shaper_funcs_t *) calloc (1, sizeof (hb_uniscribe_shaper_funcs_t));
|
||||||
if (unlikely (!funcs))
|
if (unlikely (!funcs))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
funcs->init ();
|
funcs->init ();
|
||||||
|
|
||||||
if (!hb_atomic_ptr_cmpexch (&uniscribe_funcs, NULL, funcs)) {
|
if (!hb_atomic_ptr_cmpexch (&uniscribe_funcs, nullptr, funcs)) {
|
||||||
free (funcs);
|
free (funcs);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
|
||||||
if (!new_sfnt_data)
|
if (!new_sfnt_data)
|
||||||
{
|
{
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(new_sfnt_data, orig_sfnt_data, length);
|
memcpy(new_sfnt_data, orig_sfnt_data, length);
|
||||||
|
@ -417,7 +417,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
|
||||||
{
|
{
|
||||||
free (new_sfnt_data);
|
free (new_sfnt_data);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
|
||||||
|
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
return hb_blob_create ((const char *) new_sfnt_data, new_length,
|
return hb_blob_create ((const char *) new_sfnt_data, new_length,
|
||||||
HB_MEMORY_MODE_WRITABLE, NULL, free);
|
HB_MEMORY_MODE_WRITABLE, nullptr, free);
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_uniscribe_shaper_face_data_t *
|
hb_uniscribe_shaper_face_data_t *
|
||||||
|
@ -435,13 +435,13 @@ _hb_uniscribe_shaper_face_data_create (hb_face_t *face)
|
||||||
{
|
{
|
||||||
hb_uniscribe_shaper_face_data_t *data = (hb_uniscribe_shaper_face_data_t *) calloc (1, sizeof (hb_uniscribe_shaper_face_data_t));
|
hb_uniscribe_shaper_face_data_t *data = (hb_uniscribe_shaper_face_data_t *) calloc (1, sizeof (hb_uniscribe_shaper_face_data_t));
|
||||||
if (unlikely (!data))
|
if (unlikely (!data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
data->funcs = hb_uniscribe_shaper_get_funcs ();
|
data->funcs = hb_uniscribe_shaper_get_funcs ();
|
||||||
if (unlikely (!data->funcs))
|
if (unlikely (!data->funcs))
|
||||||
{
|
{
|
||||||
free (data);
|
free (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_blob_t *blob = hb_face_reference_blob (face);
|
hb_blob_t *blob = hb_face_reference_blob (face);
|
||||||
|
@ -452,18 +452,18 @@ _hb_uniscribe_shaper_face_data_create (hb_face_t *face)
|
||||||
if (unlikely (!blob))
|
if (unlikely (!blob))
|
||||||
{
|
{
|
||||||
free (data);
|
free (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD num_fonts_installed;
|
DWORD num_fonts_installed;
|
||||||
data->fh = AddFontMemResourceEx ((void *) hb_blob_get_data (blob, NULL),
|
data->fh = AddFontMemResourceEx ((void *) hb_blob_get_data (blob, nullptr),
|
||||||
hb_blob_get_length (blob),
|
hb_blob_get_length (blob),
|
||||||
0, &num_fonts_installed);
|
0, &num_fonts_installed);
|
||||||
if (unlikely (!data->fh))
|
if (unlikely (!data->fh))
|
||||||
{
|
{
|
||||||
DEBUG_MSG (UNISCRIBE, face, "Face AddFontMemResourceEx() failed");
|
DEBUG_MSG (UNISCRIBE, face, "Face AddFontMemResourceEx() failed");
|
||||||
free (data);
|
free (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -509,11 +509,11 @@ populate_log_font (LOGFONTW *lf,
|
||||||
hb_uniscribe_shaper_font_data_t *
|
hb_uniscribe_shaper_font_data_t *
|
||||||
_hb_uniscribe_shaper_font_data_create (hb_font_t *font)
|
_hb_uniscribe_shaper_font_data_create (hb_font_t *font)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_uniscribe_shaper_face_data_ensure (font->face))) return NULL;
|
if (unlikely (!hb_uniscribe_shaper_face_data_ensure (font->face))) return nullptr;
|
||||||
|
|
||||||
hb_uniscribe_shaper_font_data_t *data = (hb_uniscribe_shaper_font_data_t *) calloc (1, sizeof (hb_uniscribe_shaper_font_data_t));
|
hb_uniscribe_shaper_font_data_t *data = (hb_uniscribe_shaper_font_data_t *) calloc (1, sizeof (hb_uniscribe_shaper_font_data_t));
|
||||||
if (unlikely (!data))
|
if (unlikely (!data))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
int font_size = font->face->get_upem (); /* Default... */
|
int font_size = font->face->get_upem (); /* Default... */
|
||||||
/* No idea if the following is even a good idea. */
|
/* No idea if the following is even a good idea. */
|
||||||
|
@ -525,25 +525,25 @@ _hb_uniscribe_shaper_font_data_create (hb_font_t *font)
|
||||||
data->x_mult = (double) font->x_scale / font_size;
|
data->x_mult = (double) font->x_scale / font_size;
|
||||||
data->y_mult = (double) font->y_scale / font_size;
|
data->y_mult = (double) font->y_scale / font_size;
|
||||||
|
|
||||||
data->hdc = GetDC (NULL);
|
data->hdc = GetDC (nullptr);
|
||||||
|
|
||||||
if (unlikely (!populate_log_font (&data->log_font, font, font_size))) {
|
if (unlikely (!populate_log_font (&data->log_font, font, font_size))) {
|
||||||
DEBUG_MSG (UNISCRIBE, font, "Font populate_log_font() failed");
|
DEBUG_MSG (UNISCRIBE, font, "Font populate_log_font() failed");
|
||||||
_hb_uniscribe_shaper_font_data_destroy (data);
|
_hb_uniscribe_shaper_font_data_destroy (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->hfont = CreateFontIndirectW (&data->log_font);
|
data->hfont = CreateFontIndirectW (&data->log_font);
|
||||||
if (unlikely (!data->hfont)) {
|
if (unlikely (!data->hfont)) {
|
||||||
DEBUG_MSG (UNISCRIBE, font, "Font CreateFontIndirectW() failed");
|
DEBUG_MSG (UNISCRIBE, font, "Font CreateFontIndirectW() failed");
|
||||||
_hb_uniscribe_shaper_font_data_destroy (data);
|
_hb_uniscribe_shaper_font_data_destroy (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SelectObject (data->hdc, data->hfont)) {
|
if (!SelectObject (data->hdc, data->hfont)) {
|
||||||
DEBUG_MSG (UNISCRIBE, font, "Font SelectObject() failed");
|
DEBUG_MSG (UNISCRIBE, font, "Font SelectObject() failed");
|
||||||
_hb_uniscribe_shaper_font_data_destroy (data);
|
_hb_uniscribe_shaper_font_data_destroy (data);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -553,7 +553,7 @@ void
|
||||||
_hb_uniscribe_shaper_font_data_destroy (hb_uniscribe_shaper_font_data_t *data)
|
_hb_uniscribe_shaper_font_data_destroy (hb_uniscribe_shaper_font_data_t *data)
|
||||||
{
|
{
|
||||||
if (data->hdc)
|
if (data->hdc)
|
||||||
ReleaseDC (NULL, data->hdc);
|
ReleaseDC (nullptr, data->hdc);
|
||||||
if (data->hfont)
|
if (data->hfont)
|
||||||
DeleteObject (data->hfont);
|
DeleteObject (data->hfont);
|
||||||
if (data->script_cache)
|
if (data->script_cache)
|
||||||
|
@ -564,7 +564,7 @@ _hb_uniscribe_shaper_font_data_destroy (hb_uniscribe_shaper_font_data_t *data)
|
||||||
LOGFONTW *
|
LOGFONTW *
|
||||||
hb_uniscribe_font_get_logfontw (hb_font_t *font)
|
hb_uniscribe_font_get_logfontw (hb_font_t *font)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_uniscribe_shaper_font_data_ensure (font))) return NULL;
|
if (unlikely (!hb_uniscribe_shaper_font_data_ensure (font))) return nullptr;
|
||||||
hb_uniscribe_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
|
hb_uniscribe_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
|
||||||
return &font_data->log_font;
|
return &font_data->log_font;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ hb_uniscribe_font_get_logfontw (hb_font_t *font)
|
||||||
HFONT
|
HFONT
|
||||||
hb_uniscribe_font_get_hfont (hb_font_t *font)
|
hb_uniscribe_font_get_hfont (hb_font_t *font)
|
||||||
{
|
{
|
||||||
if (unlikely (!hb_uniscribe_shaper_font_data_ensure (font))) return NULL;
|
if (unlikely (!hb_uniscribe_shaper_font_data_ensure (font))) return nullptr;
|
||||||
hb_uniscribe_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
|
hb_uniscribe_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
|
||||||
return font_data->hfont;
|
return font_data->hfont;
|
||||||
}
|
}
|
||||||
|
@ -738,7 +738,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
|
||||||
|
|
||||||
#define FAIL(...) \
|
#define FAIL(...) \
|
||||||
HB_STMT_START { \
|
HB_STMT_START { \
|
||||||
DEBUG_MSG (UNISCRIBE, NULL, __VA_ARGS__); \
|
DEBUG_MSG (UNISCRIBE, nullptr, __VA_ARGS__); \
|
||||||
return false; \
|
return false; \
|
||||||
} HB_STMT_END;
|
} HB_STMT_END;
|
||||||
|
|
||||||
|
@ -960,7 +960,7 @@ retry:
|
||||||
/* out */
|
/* out */
|
||||||
advances + glyphs_offset,
|
advances + glyphs_offset,
|
||||||
offsets + glyphs_offset,
|
offsets + glyphs_offset,
|
||||||
NULL);
|
nullptr);
|
||||||
if (unlikely (FAILED (hr)))
|
if (unlikely (FAILED (hr)))
|
||||||
FAIL ("ScriptPlaceOpenType() failed: 0x%08xL", hr);
|
FAIL ("ScriptPlaceOpenType() failed: 0x%08xL", hr);
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,11 @@ main (int argc, char **argv)
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *font_data = NULL;
|
const char *font_data = nullptr;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
|
GMappedFile *mf = g_mapped_file_new (argv[1], false, nullptr);
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
len = g_mapped_file_get_length (mf);
|
len = g_mapped_file_get_length (mf);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
hb_blob_t *blob = NULL;
|
hb_blob_t *blob = nullptr;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf (stderr, "usage: %s font-file\n", argv[0]);
|
fprintf (stderr, "usage: %s font-file\n", argv[0]);
|
||||||
|
@ -61,7 +61,7 @@ main (int argc, char **argv)
|
||||||
hb_memory_mode_t mm;
|
hb_memory_mode_t mm;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
|
GMappedFile *mf = g_mapped_file_new (argv[1], false, nullptr);
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
len = g_mapped_file_get_length (mf);
|
len = g_mapped_file_get_length (mf);
|
||||||
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
||||||
|
@ -86,7 +86,7 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
blob = NULL;
|
blob = nullptr;
|
||||||
|
|
||||||
unsigned int upem = hb_face_get_upem (face);
|
unsigned int upem = hb_face_get_upem (face);
|
||||||
hb_font_t *font = hb_font_create (face);
|
hb_font_t *font = hb_font_create (face);
|
||||||
|
@ -115,7 +115,7 @@ main (int argc, char **argv)
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
||||||
hb_buffer_serialize_glyphs (buf, 0, hb_buffer_get_length (buf),
|
hb_buffer_serialize_glyphs (buf, 0, hb_buffer_get_length (buf),
|
||||||
out, sizeof (out), NULL,
|
out, sizeof (out), nullptr,
|
||||||
font, HB_BUFFER_SERIALIZE_FORMAT_JSON,
|
font, HB_BUFFER_SERIALIZE_FORMAT_JSON,
|
||||||
HB_BUFFER_SERIALIZE_FLAG_DEFAULT);
|
HB_BUFFER_SERIALIZE_FLAG_DEFAULT);
|
||||||
puts (out);
|
puts (out);
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
hb_blob_t *blob = NULL;
|
hb_blob_t *blob = nullptr;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf (stderr, "usage: %s font-file\n", argv[0]);
|
fprintf (stderr, "usage: %s font-file\n", argv[0]);
|
||||||
|
@ -59,7 +59,7 @@ main (int argc, char **argv)
|
||||||
hb_memory_mode_t mm;
|
hb_memory_mode_t mm;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
|
GMappedFile *mf = g_mapped_file_new (argv[1], false, nullptr);
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
len = g_mapped_file_get_length (mf);
|
len = g_mapped_file_get_length (mf);
|
||||||
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
||||||
|
@ -85,7 +85,7 @@ main (int argc, char **argv)
|
||||||
/* Create the face */
|
/* Create the face */
|
||||||
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
blob = NULL;
|
blob = nullptr;
|
||||||
|
|
||||||
unsigned int p[5];
|
unsigned int p[5];
|
||||||
bool ret = hb_ot_layout_get_size_params (face, p, p+1, p+2, p+3, p+4);
|
bool ret = hb_ot_layout_get_size_params (face, p, p+1, p+2, p+3, p+4);
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
hb_blob_t *blob = NULL;
|
hb_blob_t *blob = nullptr;
|
||||||
|
|
||||||
if (argc != 4 && argc != 5) {
|
if (argc != 4 && argc != 5) {
|
||||||
fprintf (stderr, "usage: %s font-file lookup-index first-glyph [second-glyph]\n", argv[0]);
|
fprintf (stderr, "usage: %s font-file lookup-index first-glyph [second-glyph]\n", argv[0]);
|
||||||
|
@ -63,7 +63,7 @@ main (int argc, char **argv)
|
||||||
hb_memory_mode_t mm;
|
hb_memory_mode_t mm;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
|
GMappedFile *mf = g_mapped_file_new (argv[1], false, nullptr);
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
len = g_mapped_file_get_length (mf);
|
len = g_mapped_file_get_length (mf);
|
||||||
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
||||||
|
@ -89,7 +89,7 @@ main (int argc, char **argv)
|
||||||
/* Create the face */
|
/* Create the face */
|
||||||
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
blob = NULL;
|
blob = nullptr;
|
||||||
|
|
||||||
hb_font_t *font = hb_font_create (face);
|
hb_font_t *font = hb_font_create (face);
|
||||||
#ifdef HAVE_FREETYPE
|
#ifdef HAVE_FREETYPE
|
||||||
|
@ -102,5 +102,5 @@ main (int argc, char **argv)
|
||||||
(argc > 4 &&
|
(argc > 4 &&
|
||||||
!hb_font_glyph_from_string (font, argv[4], -1, &glyphs[1])))
|
!hb_font_glyph_from_string (font, argv[4], -1, &glyphs[1])))
|
||||||
return 2;
|
return 2;
|
||||||
return !hb_ot_layout_lookup_would_substitute (face, strtol (argv[2], NULL, 0), glyphs, len, false);
|
return !hb_ot_layout_lookup_would_substitute (face, strtol (argv[2], nullptr, 0), glyphs, len, false);
|
||||||
}
|
}
|
||||||
|
|
12
src/test.cc
12
src/test.cc
|
@ -46,7 +46,7 @@
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
hb_blob_t *blob = NULL;
|
hb_blob_t *blob = nullptr;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf (stderr, "usage: %s font-file.ttf\n", argv[0]);
|
fprintf (stderr, "usage: %s font-file.ttf\n", argv[0]);
|
||||||
|
@ -62,7 +62,7 @@ main (int argc, char **argv)
|
||||||
hb_memory_mode_t mm;
|
hb_memory_mode_t mm;
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL);
|
GMappedFile *mf = g_mapped_file_new (argv[1], false, nullptr);
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
len = g_mapped_file_get_length (mf);
|
len = g_mapped_file_get_length (mf);
|
||||||
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
destroy = (hb_destroy_func_t) g_mapped_file_unref;
|
||||||
|
@ -90,7 +90,7 @@ main (int argc, char **argv)
|
||||||
/* Create the face */
|
/* Create the face */
|
||||||
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
hb_face_t *face = hb_face_create (blob, 0 /* first face */);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
blob = NULL;
|
blob = nullptr;
|
||||||
unsigned int upem = hb_face_get_upem (face);
|
unsigned int upem = hb_face_get_upem (face);
|
||||||
|
|
||||||
hb_font_t *font = hb_font_create (face);
|
hb_font_t *font = hb_font_create (face);
|
||||||
|
@ -105,11 +105,11 @@ main (int argc, char **argv)
|
||||||
hb_buffer_add_utf8 (buffer, "\xe0\xa4\x95\xe0\xa5\x8d\xe0\xa4\xb0\xe0\xa5\x8d\xe0\xa4\x95", -1, 0, -1);
|
hb_buffer_add_utf8 (buffer, "\xe0\xa4\x95\xe0\xa5\x8d\xe0\xa4\xb0\xe0\xa5\x8d\xe0\xa4\x95", -1, 0, -1);
|
||||||
hb_buffer_guess_segment_properties (buffer);
|
hb_buffer_guess_segment_properties (buffer);
|
||||||
|
|
||||||
hb_shape (font, buffer, NULL, 0);
|
hb_shape (font, buffer, nullptr, 0);
|
||||||
|
|
||||||
unsigned int count = hb_buffer_get_length (buffer);
|
unsigned int count = hb_buffer_get_length (buffer);
|
||||||
hb_glyph_info_t *infos = hb_buffer_get_glyph_infos (buffer, NULL);
|
hb_glyph_info_t *infos = hb_buffer_get_glyph_infos (buffer, nullptr);
|
||||||
hb_glyph_position_t *positions = hb_buffer_get_glyph_positions (buffer, NULL);
|
hb_glyph_position_t *positions = hb_buffer_get_glyph_positions (buffer, nullptr);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -353,7 +353,7 @@ block_best (const biimage_t &bi, bool *inverse)
|
||||||
} else
|
} else
|
||||||
qs += quad[i][j];
|
qs += quad[i][j];
|
||||||
if (qs < score) {
|
if (qs < score) {
|
||||||
const char *c = NULL;
|
const char *c = nullptr;
|
||||||
bool inv = false;
|
bool inv = false;
|
||||||
switch (q) {
|
switch (q) {
|
||||||
case 1: c = "▟"; inv = true; break;
|
case 1: c = "▟"; inv = true; break;
|
||||||
|
|
|
@ -82,7 +82,7 @@ _hb_fc_get_font_funcs (void)
|
||||||
{
|
{
|
||||||
hb_font_funcs_t *newfuncs = hb_font_funcs_create ();
|
hb_font_funcs_t *newfuncs = hb_font_funcs_create ();
|
||||||
|
|
||||||
hb_font_funcs_set_glyph_func (newfuncs, hb_fc_get_glyph, NULL, NULL);
|
hb_font_funcs_set_glyph_func (newfuncs, hb_fc_get_glyph, nullptr, nullptr);
|
||||||
|
|
||||||
/* XXX MT-unsafe */
|
/* XXX MT-unsafe */
|
||||||
if (fc_ffuncs)
|
if (fc_ffuncs)
|
||||||
|
@ -121,7 +121,7 @@ hb_fc_font_create (FcPattern *fcfont)
|
||||||
hb_bool_t
|
hb_bool_t
|
||||||
hb_fc_can_render (hb_font_t *font, const char *text)
|
hb_fc_can_render (hb_font_t *font, const char *text)
|
||||||
{
|
{
|
||||||
static const char *ot[] = {"ot", NULL};
|
static const char *ot[] = {"ot", nullptr};
|
||||||
|
|
||||||
hb_buffer_t *buffer = hb_buffer_create ();
|
hb_buffer_t *buffer = hb_buffer_create ();
|
||||||
hb_buffer_add_utf8 (buffer, text, -1, 0, -1);
|
hb_buffer_add_utf8 (buffer, text, -1, 0, -1);
|
||||||
|
@ -132,7 +132,7 @@ hb_fc_can_render (hb_font_t *font, const char *text)
|
||||||
* Might be better to force generic shaper perhaps. */
|
* Might be better to force generic shaper perhaps. */
|
||||||
hb_buffer_guess_segment_properties (buffer);
|
hb_buffer_guess_segment_properties (buffer);
|
||||||
|
|
||||||
if (!hb_shape_full (font, buffer, NULL, 0, ot))
|
if (!hb_shape_full (font, buffer, nullptr, 0, ot))
|
||||||
abort (); /* hb-ot shaper not enabled? */
|
abort (); /* hb-ot shaper not enabled? */
|
||||||
|
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
|
@ -43,8 +43,8 @@ struct shape_closure_consumer_t : option_group_t
|
||||||
{
|
{
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"no-glyph-names", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_glyph_names, "Use glyph indices instead of names", NULL},
|
{"no-glyph-names", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_glyph_names, "Use glyph indices instead of names", nullptr},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"format",
|
"format",
|
||||||
|
@ -93,11 +93,11 @@ struct shape_closure_consumer_t : option_group_t
|
||||||
{
|
{
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
hb_font_destroy (font);
|
hb_font_destroy (font);
|
||||||
font = NULL;
|
font = nullptr;
|
||||||
hb_set_destroy (glyphs);
|
hb_set_destroy (glyphs);
|
||||||
glyphs = NULL;
|
glyphs = nullptr;
|
||||||
hb_buffer_destroy (buffer);
|
hb_buffer_destroy (buffer);
|
||||||
buffer = NULL;
|
buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool failed;
|
bool failed;
|
||||||
|
|
|
@ -33,16 +33,16 @@ struct output_buffer_t
|
||||||
output_buffer_t (option_parser_t *parser)
|
output_buffer_t (option_parser_t *parser)
|
||||||
: options (parser, hb_buffer_serialize_list_formats ()),
|
: options (parser, hb_buffer_serialize_list_formats ()),
|
||||||
format (parser),
|
format (parser),
|
||||||
gs (NULL),
|
gs (nullptr),
|
||||||
line_no (0),
|
line_no (0),
|
||||||
font (NULL),
|
font (nullptr),
|
||||||
output_format (HB_BUFFER_SERIALIZE_FORMAT_INVALID),
|
output_format (HB_BUFFER_SERIALIZE_FORMAT_INVALID),
|
||||||
format_flags (HB_BUFFER_SERIALIZE_FLAG_DEFAULT) {}
|
format_flags (HB_BUFFER_SERIALIZE_FLAG_DEFAULT) {}
|
||||||
|
|
||||||
void init (hb_buffer_t *buffer, const font_options_t *font_opts)
|
void init (hb_buffer_t *buffer, const font_options_t *font_opts)
|
||||||
{
|
{
|
||||||
options.get_file_handle ();
|
options.get_file_handle ();
|
||||||
gs = g_string_new (NULL);
|
gs = g_string_new (nullptr);
|
||||||
line_no = 0;
|
line_no = 0;
|
||||||
font = hb_font_reference (font_opts->get_font ());
|
font = hb_font_reference (font_opts->get_font ());
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ struct output_buffer_t
|
||||||
format_flags = (hb_buffer_serialize_flags_t) flags;
|
format_flags = (hb_buffer_serialize_flags_t) flags;
|
||||||
|
|
||||||
if (format.trace)
|
if (format.trace)
|
||||||
hb_buffer_set_message_func (buffer, message_func, this, NULL);
|
hb_buffer_set_message_func (buffer, message_func, this, nullptr);
|
||||||
}
|
}
|
||||||
void new_line (void)
|
void new_line (void)
|
||||||
{
|
{
|
||||||
|
@ -112,11 +112,11 @@ struct output_buffer_t
|
||||||
}
|
}
|
||||||
void finish (hb_buffer_t *buffer, const font_options_t *font_opts)
|
void finish (hb_buffer_t *buffer, const font_options_t *font_opts)
|
||||||
{
|
{
|
||||||
hb_buffer_set_message_func (buffer, NULL, NULL, NULL);
|
hb_buffer_set_message_func (buffer, nullptr, nullptr, nullptr);
|
||||||
hb_font_destroy (font);
|
hb_font_destroy (font);
|
||||||
g_string_free (gs, true);
|
g_string_free (gs, true);
|
||||||
gs = NULL;
|
gs = nullptr;
|
||||||
font = NULL;
|
font = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hb_bool_t
|
static hb_bool_t
|
||||||
|
|
|
@ -79,7 +79,7 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts)
|
||||||
/* We cannot use the FT_Face from hb_font_t, as doing so will confuse hb_font_t because
|
/* We cannot use the FT_Face from hb_font_t, as doing so will confuse hb_font_t because
|
||||||
* cairo will reset the face size. As such, create new face...
|
* cairo will reset the face size. As such, create new face...
|
||||||
* TODO Perhaps add API to hb-ft to encapsulate this code. */
|
* TODO Perhaps add API to hb-ft to encapsulate this code. */
|
||||||
FT_Face ft_face = NULL;//hb_ft_font_get_face (font);
|
FT_Face ft_face = nullptr;//hb_ft_font_get_face (font);
|
||||||
if (!ft_face)
|
if (!ft_face)
|
||||||
{
|
{
|
||||||
if (!ft_library)
|
if (!ft_library)
|
||||||
|
@ -325,7 +325,7 @@ const char *helper_cairo_supported_formats[] =
|
||||||
"eps",
|
"eps",
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
cairo_t *
|
cairo_t *
|
||||||
|
@ -337,12 +337,12 @@ helper_cairo_create_context (double w, double h,
|
||||||
cairo_surface_t *(*constructor) (cairo_write_func_t write_func,
|
cairo_surface_t *(*constructor) (cairo_write_func_t write_func,
|
||||||
void *closure,
|
void *closure,
|
||||||
double width,
|
double width,
|
||||||
double height) = NULL;
|
double height) = nullptr;
|
||||||
cairo_surface_t *(*constructor2) (cairo_write_func_t write_func,
|
cairo_surface_t *(*constructor2) (cairo_write_func_t write_func,
|
||||||
void *closure,
|
void *closure,
|
||||||
double width,
|
double width,
|
||||||
double height,
|
double height,
|
||||||
cairo_content_t content) = NULL;
|
cairo_content_t content) = nullptr;
|
||||||
|
|
||||||
const char *extension = out_opts->output_format;
|
const char *extension = out_opts->output_format;
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
|
@ -471,8 +471,8 @@ helper_cairo_line_from_buffer (helper_cairo_line_t *l,
|
||||||
memset (l, 0, sizeof (*l));
|
memset (l, 0, sizeof (*l));
|
||||||
|
|
||||||
l->num_glyphs = hb_buffer_get_length (buffer);
|
l->num_glyphs = hb_buffer_get_length (buffer);
|
||||||
hb_glyph_info_t *hb_glyph = hb_buffer_get_glyph_infos (buffer, NULL);
|
hb_glyph_info_t *hb_glyph = hb_buffer_get_glyph_infos (buffer, nullptr);
|
||||||
hb_glyph_position_t *hb_position = hb_buffer_get_glyph_positions (buffer, NULL);
|
hb_glyph_position_t *hb_position = hb_buffer_get_glyph_positions (buffer, nullptr);
|
||||||
l->glyphs = cairo_glyph_allocate (l->num_glyphs + 1);
|
l->glyphs = cairo_glyph_allocate (l->num_glyphs + 1);
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
|
|
|
@ -35,9 +35,9 @@ static char *
|
||||||
locale_to_utf8 (char *s)
|
locale_to_utf8 (char *s)
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
|
|
||||||
t = g_locale_to_utf8 (s, -1, NULL, NULL, &error);
|
t = g_locale_to_utf8 (s, -1, nullptr, nullptr, &error);
|
||||||
if (!t)
|
if (!t)
|
||||||
{
|
{
|
||||||
fail (true, "Failed converting text to UTF-8");
|
fail (true, "Failed converting text to UTF-8");
|
||||||
|
|
110
util/options.cc
110
util/options.cc
|
@ -70,7 +70,7 @@ hb_bool_t debug = false;
|
||||||
static gchar *
|
static gchar *
|
||||||
shapers_to_string (void)
|
shapers_to_string (void)
|
||||||
{
|
{
|
||||||
GString *shapers = g_string_new (NULL);
|
GString *shapers = g_string_new (nullptr);
|
||||||
const char **shaper_list = hb_shape_list_shapers ();
|
const char **shaper_list = hb_shape_list_shapers ();
|
||||||
|
|
||||||
for (; *shaper_list; shaper_list++) {
|
for (; *shaper_list; shaper_list++) {
|
||||||
|
@ -106,11 +106,11 @@ option_parser_t::add_main_options (void)
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"version", 0, G_OPTION_FLAG_NO_ARG,
|
{"version", 0, G_OPTION_FLAG_NO_ARG,
|
||||||
G_OPTION_ARG_CALLBACK, (gpointer) &show_version, "Show version numbers", NULL},
|
G_OPTION_ARG_CALLBACK, (gpointer) &show_version, "Show version numbers", nullptr},
|
||||||
{"debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Free all resources before exit", NULL},
|
{"debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Free all resources before exit", nullptr},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
g_option_context_add_main_entries (context, entries, NULL);
|
g_option_context_add_main_entries (context, entries, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -121,7 +121,7 @@ pre_parse (GOptionContext *context G_GNUC_UNUSED,
|
||||||
{
|
{
|
||||||
option_group_t *option_group = (option_group_t *) data;
|
option_group_t *option_group = (option_group_t *) data;
|
||||||
option_group->pre_parse (error);
|
option_group->pre_parse (error);
|
||||||
return *error == NULL;
|
return *error == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -132,7 +132,7 @@ post_parse (GOptionContext *context G_GNUC_UNUSED,
|
||||||
{
|
{
|
||||||
option_group_t *option_group = static_cast<option_group_t *>(data);
|
option_group_t *option_group = static_cast<option_group_t *>(data);
|
||||||
option_group->post_parse (error);
|
option_group->post_parse (error);
|
||||||
return *error == NULL;
|
return *error == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -143,7 +143,7 @@ option_parser_t::add_group (GOptionEntry *entries,
|
||||||
option_group_t *option_group)
|
option_group_t *option_group)
|
||||||
{
|
{
|
||||||
GOptionGroup *group = g_option_group_new (name, description, help_description,
|
GOptionGroup *group = g_option_group_new (name, description, help_description,
|
||||||
static_cast<gpointer>(option_group), NULL);
|
static_cast<gpointer>(option_group), nullptr);
|
||||||
g_option_group_add_entries (group, entries);
|
g_option_group_add_entries (group, entries);
|
||||||
g_option_group_set_parse_hooks (group, pre_parse, post_parse);
|
g_option_group_set_parse_hooks (group, pre_parse, post_parse);
|
||||||
g_option_context_add_group (context, group);
|
g_option_context_add_group (context, group);
|
||||||
|
@ -154,10 +154,10 @@ option_parser_t::parse (int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
|
|
||||||
GError *parse_error = NULL;
|
GError *parse_error = nullptr;
|
||||||
if (!g_option_context_parse (context, argc, argv, &parse_error))
|
if (!g_option_context_parse (context, argc, argv, &parse_error))
|
||||||
{
|
{
|
||||||
if (parse_error != NULL) {
|
if (parse_error != nullptr) {
|
||||||
fail (true, "%s", parse_error->message);
|
fail (true, "%s", parse_error->message);
|
||||||
//g_error_free (parse_error);
|
//g_error_free (parse_error);
|
||||||
} else
|
} else
|
||||||
|
@ -225,7 +225,7 @@ parse_features (const char *name G_GNUC_UNUSED,
|
||||||
|
|
||||||
shape_opts->num_features = 0;
|
shape_opts->num_features = 0;
|
||||||
g_free (shape_opts->features);
|
g_free (shape_opts->features);
|
||||||
shape_opts->features = NULL;
|
shape_opts->features = nullptr;
|
||||||
|
|
||||||
if (!*s)
|
if (!*s)
|
||||||
return true;
|
return true;
|
||||||
|
@ -250,7 +250,7 @@ parse_features (const char *name G_GNUC_UNUSED,
|
||||||
char *end = strchr (p, ',');
|
char *end = strchr (p, ',');
|
||||||
if (hb_feature_from_string (p, end ? end - p : -1, &shape_opts->features[shape_opts->num_features]))
|
if (hb_feature_from_string (p, end ? end - p : -1, &shape_opts->features[shape_opts->num_features]))
|
||||||
shape_opts->num_features++;
|
shape_opts->num_features++;
|
||||||
p = end ? end + 1 : NULL;
|
p = end ? end + 1 : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -268,7 +268,7 @@ parse_variations (const char *name G_GNUC_UNUSED,
|
||||||
|
|
||||||
font_opts->num_variations = 0;
|
font_opts->num_variations = 0;
|
||||||
g_free (font_opts->variations);
|
g_free (font_opts->variations);
|
||||||
font_opts->variations = NULL;
|
font_opts->variations = nullptr;
|
||||||
|
|
||||||
if (!*s)
|
if (!*s)
|
||||||
return true;
|
return true;
|
||||||
|
@ -293,7 +293,7 @@ parse_variations (const char *name G_GNUC_UNUSED,
|
||||||
char *end = strchr (p, ',');
|
char *end = strchr (p, ',');
|
||||||
if (hb_variation_from_string (p, end ? end - p : -1, &font_opts->variations[font_opts->num_variations]))
|
if (hb_variation_from_string (p, end ? end - p : -1, &font_opts->variations[font_opts->num_variations]))
|
||||||
font_opts->num_variations++;
|
font_opts->num_variations++;
|
||||||
p = end ? end + 1 : NULL;
|
p = end ? end + 1 : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -334,7 +334,7 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GString *gs = g_string_new (NULL);
|
GString *gs = g_string_new (nullptr);
|
||||||
char *s = (char *) arg;
|
char *s = (char *) arg;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -367,12 +367,12 @@ view_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"annotate", 0, 0, G_OPTION_ARG_NONE, &this->annotate, "Annotate output rendering", NULL},
|
{"annotate", 0, 0, G_OPTION_ARG_NONE, &this->annotate, "Annotate output rendering", nullptr},
|
||||||
{"background", 0, 0, G_OPTION_ARG_STRING, &this->back, "Set background color (default: " DEFAULT_BACK ")", "rrggbb/rrggbbaa"},
|
{"background", 0, 0, G_OPTION_ARG_STRING, &this->back, "Set background color (default: " DEFAULT_BACK ")", "rrggbb/rrggbbaa"},
|
||||||
{"foreground", 0, 0, G_OPTION_ARG_STRING, &this->fore, "Set foreground color (default: " DEFAULT_FORE ")", "rrggbb/rrggbbaa"},
|
{"foreground", 0, 0, G_OPTION_ARG_STRING, &this->fore, "Set foreground color (default: " DEFAULT_FORE ")", "rrggbb/rrggbbaa"},
|
||||||
{"line-space", 0, 0, G_OPTION_ARG_DOUBLE, &this->line_space, "Set space between lines (default: 0)", "units"},
|
{"line-space", 0, 0, G_OPTION_ARG_DOUBLE, &this->line_space, "Set space between lines (default: 0)", "units"},
|
||||||
{"margin", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_margin, "Margin around output (default: " G_STRINGIFY(DEFAULT_MARGIN) ")","one to four numbers"},
|
{"margin", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_margin, "Margin around output (default: " G_STRINGIFY(DEFAULT_MARGIN) ")","one to four numbers"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"view",
|
"view",
|
||||||
|
@ -387,22 +387,22 @@ shape_options_t::add_options (option_parser_t *parser)
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"list-shapers", 0, G_OPTION_FLAG_NO_ARG,
|
{"list-shapers", 0, G_OPTION_FLAG_NO_ARG,
|
||||||
G_OPTION_ARG_CALLBACK, (gpointer) &list_shapers, "List available shapers and quit", NULL},
|
G_OPTION_ARG_CALLBACK, (gpointer) &list_shapers, "List available shapers and quit", nullptr},
|
||||||
{"shaper", 0, G_OPTION_FLAG_HIDDEN,
|
{"shaper", 0, G_OPTION_FLAG_HIDDEN,
|
||||||
G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Hidden duplicate of --shapers", NULL},
|
G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Hidden duplicate of --shapers", nullptr},
|
||||||
{"shapers", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Set comma-separated list of shapers to try","list"},
|
{"shapers", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Set comma-separated list of shapers to try","list"},
|
||||||
{"direction", 0, 0, G_OPTION_ARG_STRING, &this->direction, "Set text direction (default: auto)", "ltr/rtl/ttb/btt"},
|
{"direction", 0, 0, G_OPTION_ARG_STRING, &this->direction, "Set text direction (default: auto)", "ltr/rtl/ttb/btt"},
|
||||||
{"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "langstr"},
|
{"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "langstr"},
|
||||||
{"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"},
|
{"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"},
|
||||||
{"bot", 0, 0, G_OPTION_ARG_NONE, &this->bot, "Treat text as beginning-of-paragraph", NULL},
|
{"bot", 0, 0, G_OPTION_ARG_NONE, &this->bot, "Treat text as beginning-of-paragraph", nullptr},
|
||||||
{"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", NULL},
|
{"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", nullptr},
|
||||||
{"preserve-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->preserve_default_ignorables, "Preserve Default-Ignorable characters", NULL},
|
{"preserve-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->preserve_default_ignorables, "Preserve Default-Ignorable characters", nullptr},
|
||||||
{"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", NULL},
|
{"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", nullptr},
|
||||||
{"cluster-level", 0, 0, G_OPTION_ARG_INT, &this->cluster_level, "Cluster merging level (default: 0)", "0/1/2"},
|
{"cluster-level", 0, 0, G_OPTION_ARG_INT, &this->cluster_level, "Cluster merging level (default: 0)", "0/1/2"},
|
||||||
{"normalize-glyphs",0, 0, G_OPTION_ARG_NONE, &this->normalize_glyphs, "Rearrange glyph clusters in nominal order", NULL},
|
{"normalize-glyphs",0, 0, G_OPTION_ARG_NONE, &this->normalize_glyphs, "Rearrange glyph clusters in nominal order", nullptr},
|
||||||
{"verify", 0, 0, G_OPTION_ARG_NONE, &this->verify, "Perform sanity checks on shaping results", NULL},
|
{"verify", 0, 0, G_OPTION_ARG_NONE, &this->verify, "Perform sanity checks on shaping results", nullptr},
|
||||||
{"num-iterations", 0, 0, G_OPTION_ARG_INT, &this->num_iterations, "Run shaper N times (default: 1)", "N"},
|
{"num-iterations", 0, 0, G_OPTION_ARG_INT, &this->num_iterations, "Run shaper N times (default: 1)", "N"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"shape",
|
"shape",
|
||||||
|
@ -449,7 +449,7 @@ shape_options_t::add_options (option_parser_t *parser)
|
||||||
GOptionEntry entries2[] =
|
GOptionEntry entries2[] =
|
||||||
{
|
{
|
||||||
{"features", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_features, features_help, "list"},
|
{"features", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_features, features_help, "list"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries2,
|
parser->add_group (entries2,
|
||||||
"features",
|
"features",
|
||||||
|
@ -483,12 +483,12 @@ parse_font_size (const char *name G_GNUC_UNUSED,
|
||||||
void
|
void
|
||||||
font_options_t::add_options (option_parser_t *parser)
|
font_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
char *text = NULL;
|
char *text = nullptr;
|
||||||
|
|
||||||
{
|
{
|
||||||
static_assert ((ARRAY_LENGTH_CONST (supported_font_funcs) > 0),
|
static_assert ((ARRAY_LENGTH_CONST (supported_font_funcs) > 0),
|
||||||
"No supported font-funcs found.");
|
"No supported font-funcs found.");
|
||||||
GString *s = g_string_new (NULL);
|
GString *s = g_string_new (nullptr);
|
||||||
g_string_printf (s, "Set font functions implementation to use (default: %s)\n\n Supported font function implementations are: %s",
|
g_string_printf (s, "Set font functions implementation to use (default: %s)\n\n Supported font function implementations are: %s",
|
||||||
supported_font_funcs[0].name,
|
supported_font_funcs[0].name,
|
||||||
supported_font_funcs[0].name);
|
supported_font_funcs[0].name);
|
||||||
|
@ -517,7 +517,7 @@ font_options_t::add_options (option_parser_t *parser)
|
||||||
{"font-size", 0, default_font_size ? 0 : G_OPTION_FLAG_HIDDEN,
|
{"font-size", 0, default_font_size ? 0 : G_OPTION_FLAG_HIDDEN,
|
||||||
G_OPTION_ARG_CALLBACK, (gpointer) &parse_font_size, font_size_text, "1/2 numbers or 'upem'"},
|
G_OPTION_ARG_CALLBACK, (gpointer) &parse_font_size, font_size_text, "1/2 numbers or 'upem'"},
|
||||||
{"font-funcs", 0, 0, G_OPTION_ARG_STRING, &this->font_funcs, text, "impl"},
|
{"font-funcs", 0, 0, G_OPTION_ARG_STRING, &this->font_funcs, text, "impl"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"font",
|
"font",
|
||||||
|
@ -540,7 +540,7 @@ font_options_t::add_options (option_parser_t *parser)
|
||||||
GOptionEntry entries2[] =
|
GOptionEntry entries2[] =
|
||||||
{
|
{
|
||||||
{"variations", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_variations, variations_help, "list"},
|
{"variations", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_variations, variations_help, "list"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries2,
|
parser->add_group (entries2,
|
||||||
"variations",
|
"variations",
|
||||||
|
@ -559,7 +559,7 @@ text_options_t::add_options (option_parser_t *parser)
|
||||||
{"unicodes", 'u', 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_unicodes, "Set input Unicode codepoints", "list of hex numbers"},
|
{"unicodes", 'u', 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_unicodes, "Set input Unicode codepoints", "list of hex numbers"},
|
||||||
{"text-before", 0, 0, G_OPTION_ARG_STRING, &this->text_before, "Set text context before each line", "string"},
|
{"text-before", 0, 0, G_OPTION_ARG_STRING, &this->text_before, "Set text context before each line", "string"},
|
||||||
{"text-after", 0, 0, G_OPTION_ARG_STRING, &this->text_after, "Set text context after each line", "string"},
|
{"text-after", 0, 0, G_OPTION_ARG_STRING, &this->text_after, "Set text context after each line", "string"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"text",
|
"text",
|
||||||
|
@ -573,7 +573,7 @@ output_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
|
|
||||||
if (NULL == supported_formats)
|
if (nullptr == supported_formats)
|
||||||
text = "Set output serialization format";
|
text = "Set output serialization format";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -587,7 +587,7 @@ output_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
{"output-file", 'o', 0, G_OPTION_ARG_STRING, &this->output_file, "Set output file-name (default: stdout)","filename"},
|
{"output-file", 'o', 0, G_OPTION_ARG_STRING, &this->output_file, "Set output file-name (default: stdout)","filename"},
|
||||||
{"output-format", 'O', 0, G_OPTION_ARG_STRING, &this->output_format, text, "format"},
|
{"output-format", 'O', 0, G_OPTION_ARG_STRING, &this->output_format, text, "format"},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"output",
|
"output",
|
||||||
|
@ -604,7 +604,7 @@ font_options_t::get_font (void) const
|
||||||
if (font)
|
if (font)
|
||||||
return font;
|
return font;
|
||||||
|
|
||||||
hb_blob_t *blob = NULL;
|
hb_blob_t *blob = nullptr;
|
||||||
|
|
||||||
/* Create the blob */
|
/* Create the blob */
|
||||||
{
|
{
|
||||||
|
@ -620,7 +620,7 @@ font_options_t::get_font (void) const
|
||||||
|
|
||||||
if (0 == strcmp (font_file, "-")) {
|
if (0 == strcmp (font_file, "-")) {
|
||||||
/* read it */
|
/* read it */
|
||||||
GString *gs = g_string_new (NULL);
|
GString *gs = g_string_new (nullptr);
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
setmode (fileno (stdin), O_BINARY);
|
setmode (fileno (stdin), O_BINARY);
|
||||||
|
@ -638,7 +638,7 @@ font_options_t::get_font (void) const
|
||||||
destroy = (hb_destroy_func_t) g_free;
|
destroy = (hb_destroy_func_t) g_free;
|
||||||
mm = HB_MEMORY_MODE_WRITABLE;
|
mm = HB_MEMORY_MODE_WRITABLE;
|
||||||
} else {
|
} else {
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
GMappedFile *mf = g_mapped_file_new (font_file, false, &error);
|
GMappedFile *mf = g_mapped_file_new (font_file, false, &error);
|
||||||
if (mf) {
|
if (mf) {
|
||||||
font_data = g_mapped_file_get_contents (mf);
|
font_data = g_mapped_file_get_contents (mf);
|
||||||
|
@ -657,7 +657,7 @@ font_options_t::get_font (void) const
|
||||||
/* GMappedFile is buggy, it doesn't fail if file isn't regular.
|
/* GMappedFile is buggy, it doesn't fail if file isn't regular.
|
||||||
* Try reading.
|
* Try reading.
|
||||||
* https://bugzilla.gnome.org/show_bug.cgi?id=659212 */
|
* https://bugzilla.gnome.org/show_bug.cgi?id=659212 */
|
||||||
GError *error = NULL;
|
GError *error = nullptr;
|
||||||
gsize l;
|
gsize l;
|
||||||
if (g_file_get_contents (font_file, &font_data, &l, &error)) {
|
if (g_file_get_contents (font_file, &font_data, &l, &error)) {
|
||||||
len = l;
|
len = l;
|
||||||
|
@ -696,7 +696,7 @@ font_options_t::get_font (void) const
|
||||||
|
|
||||||
hb_font_set_variations (font, variations, num_variations);
|
hb_font_set_variations (font, variations, num_variations);
|
||||||
|
|
||||||
void (*set_font_funcs) (hb_font_t *) = NULL;
|
void (*set_font_funcs) (hb_font_t *) = nullptr;
|
||||||
if (!font_funcs)
|
if (!font_funcs)
|
||||||
{
|
{
|
||||||
set_font_funcs = supported_font_funcs[0].func;
|
set_font_funcs = supported_font_funcs[0].func;
|
||||||
|
@ -711,7 +711,7 @@ font_options_t::get_font (void) const
|
||||||
}
|
}
|
||||||
if (!set_font_funcs)
|
if (!set_font_funcs)
|
||||||
{
|
{
|
||||||
GString *s = g_string_new (NULL);
|
GString *s = g_string_new (nullptr);
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++)
|
||||||
{
|
{
|
||||||
if (i)
|
if (i)
|
||||||
|
@ -742,7 +742,7 @@ text_options_t::get_line (unsigned int *len)
|
||||||
|
|
||||||
if (!line_len) {
|
if (!line_len) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ret = line;
|
const char *ret = line;
|
||||||
|
@ -775,7 +775,7 @@ text_options_t::get_line (unsigned int *len)
|
||||||
fail (false, "Failed opening text file `%s': %s",
|
fail (false, "Failed opening text file `%s': %s",
|
||||||
text_file, strerror (errno));
|
text_file, strerror (errno));
|
||||||
|
|
||||||
gs = g_string_new (NULL);
|
gs = g_string_new (nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_string_set_size (gs, 0);
|
g_string_set_size (gs, 0);
|
||||||
|
@ -793,7 +793,7 @@ text_options_t::get_line (unsigned int *len)
|
||||||
fail (false, "Failed reading text: %s",
|
fail (false, "Failed reading text: %s",
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
*len = gs->len;
|
*len = gs->len;
|
||||||
return !*len && feof (fp) ? NULL : gs->str;
|
return !*len && feof (fp) ? nullptr : gs->str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -834,21 +834,21 @@ format_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"show-text", 0, 0, G_OPTION_ARG_NONE, &this->show_text, "Prefix each line of output with its corresponding input text", NULL},
|
{"show-text", 0, 0, G_OPTION_ARG_NONE, &this->show_text, "Prefix each line of output with its corresponding input text", nullptr},
|
||||||
{"show-unicode", 0, 0, G_OPTION_ARG_NONE, &this->show_unicode, "Prefix each line of output with its corresponding input codepoint(s)", NULL},
|
{"show-unicode", 0, 0, G_OPTION_ARG_NONE, &this->show_unicode, "Prefix each line of output with its corresponding input codepoint(s)", nullptr},
|
||||||
{"show-line-num", 0, 0, G_OPTION_ARG_NONE, &this->show_line_num, "Prefix each line of output with its corresponding input line number", NULL},
|
{"show-line-num", 0, 0, G_OPTION_ARG_NONE, &this->show_line_num, "Prefix each line of output with its corresponding input line number", nullptr},
|
||||||
{"verbose", 'v', G_OPTION_FLAG_NO_ARG,
|
{"verbose", 'v', G_OPTION_FLAG_NO_ARG,
|
||||||
G_OPTION_ARG_CALLBACK, (gpointer) &parse_verbose, "Prefix each line of output with all of the above", NULL},
|
G_OPTION_ARG_CALLBACK, (gpointer) &parse_verbose, "Prefix each line of output with all of the above", nullptr},
|
||||||
{"no-glyph-names", 0, G_OPTION_FLAG_REVERSE,
|
{"no-glyph-names", 0, G_OPTION_FLAG_REVERSE,
|
||||||
G_OPTION_ARG_NONE, &this->show_glyph_names, "Output glyph indices instead of names", NULL},
|
G_OPTION_ARG_NONE, &this->show_glyph_names, "Output glyph indices instead of names", nullptr},
|
||||||
{"no-positions", 0, G_OPTION_FLAG_REVERSE,
|
{"no-positions", 0, G_OPTION_FLAG_REVERSE,
|
||||||
G_OPTION_ARG_NONE, &this->show_positions, "Do not output glyph positions", NULL},
|
G_OPTION_ARG_NONE, &this->show_positions, "Do not output glyph positions", nullptr},
|
||||||
{"no-clusters", 0, G_OPTION_FLAG_REVERSE,
|
{"no-clusters", 0, G_OPTION_FLAG_REVERSE,
|
||||||
G_OPTION_ARG_NONE, &this->show_clusters, "Do not output cluster indices", NULL},
|
G_OPTION_ARG_NONE, &this->show_clusters, "Do not output cluster indices", nullptr},
|
||||||
{"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Output glyph extents", NULL},
|
{"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Output glyph extents", nullptr},
|
||||||
{"show-flags", 0, 0, G_OPTION_ARG_NONE, &this->show_flags, "Output glyph flags", NULL},
|
{"show-flags", 0, 0, G_OPTION_ARG_NONE, &this->show_flags, "Output glyph flags", nullptr},
|
||||||
{"trace", 'V', 0, G_OPTION_ARG_NONE, &this->trace, "Output interim shaping results", NULL},
|
{"trace", 'V', 0, G_OPTION_ARG_NONE, &this->trace, "Output interim shaping results", nullptr},
|
||||||
{NULL}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
"output-syntax",
|
"output-syntax",
|
||||||
|
@ -865,7 +865,7 @@ format_options_t::serialize_unicode (hb_buffer_t *buffer,
|
||||||
GString *gs)
|
GString *gs)
|
||||||
{
|
{
|
||||||
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
|
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
|
||||||
|
|
||||||
g_string_append_c (gs, '<');
|
g_string_append_c (gs, '<');
|
||||||
for (unsigned int i = 0; i < num_glyphs; i++)
|
for (unsigned int i = 0; i < num_glyphs; i++)
|
||||||
|
|
|
@ -90,7 +90,7 @@ struct option_parser_t
|
||||||
}
|
}
|
||||||
~option_parser_t (void) {
|
~option_parser_t (void) {
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
g_ptr_array_foreach (to_free, (GFunc) g_free, NULL);
|
g_ptr_array_foreach (to_free, (GFunc) g_free, nullptr);
|
||||||
g_ptr_array_free (to_free, TRUE);
|
g_ptr_array_free (to_free, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +130,8 @@ struct view_options_t : option_group_t
|
||||||
{
|
{
|
||||||
view_options_t (option_parser_t *parser) {
|
view_options_t (option_parser_t *parser) {
|
||||||
annotate = false;
|
annotate = false;
|
||||||
fore = NULL;
|
fore = nullptr;
|
||||||
back = NULL;
|
back = nullptr;
|
||||||
line_space = 0;
|
line_space = 0;
|
||||||
margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN;
|
margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN;
|
||||||
|
|
||||||
|
@ -159,11 +159,11 @@ struct shape_options_t : option_group_t
|
||||||
{
|
{
|
||||||
shape_options_t (option_parser_t *parser)
|
shape_options_t (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
direction = language = script = NULL;
|
direction = language = script = nullptr;
|
||||||
bot = eot = preserve_default_ignorables = false;
|
bot = eot = preserve_default_ignorables = false;
|
||||||
features = NULL;
|
features = nullptr;
|
||||||
num_features = 0;
|
num_features = 0;
|
||||||
shapers = NULL;
|
shapers = nullptr;
|
||||||
utf8_clusters = false;
|
utf8_clusters = false;
|
||||||
cluster_level = HB_BUFFER_CLUSTER_LEVEL_DEFAULT;
|
cluster_level = HB_BUFFER_CLUSTER_LEVEL_DEFAULT;
|
||||||
normalize_glyphs = false;
|
normalize_glyphs = false;
|
||||||
|
@ -222,7 +222,7 @@ struct shape_options_t : option_group_t
|
||||||
/* Reset cluster values to refer to Unicode character index
|
/* Reset cluster values to refer to Unicode character index
|
||||||
* instead of UTF-8 index. */
|
* instead of UTF-8 index. */
|
||||||
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
|
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
|
||||||
for (unsigned int i = 0; i < num_glyphs; i++)
|
for (unsigned int i = 0; i < num_glyphs; i++)
|
||||||
{
|
{
|
||||||
info->cluster = i;
|
info->cluster = i;
|
||||||
|
@ -233,9 +233,9 @@ struct shape_options_t : option_group_t
|
||||||
setup_buffer (buffer);
|
setup_buffer (buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer, const char **error=NULL)
|
hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer, const char **error=nullptr)
|
||||||
{
|
{
|
||||||
hb_buffer_t *text_buffer = NULL;
|
hb_buffer_t *text_buffer = nullptr;
|
||||||
if (verify)
|
if (verify)
|
||||||
{
|
{
|
||||||
text_buffer = hb_buffer_create ();
|
text_buffer = hb_buffer_create ();
|
||||||
|
@ -264,7 +264,7 @@ struct shape_options_t : option_group_t
|
||||||
bool verify_buffer (hb_buffer_t *buffer,
|
bool verify_buffer (hb_buffer_t *buffer,
|
||||||
hb_buffer_t *text_buffer,
|
hb_buffer_t *text_buffer,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
const char **error=NULL)
|
const char **error=nullptr)
|
||||||
{
|
{
|
||||||
if (!verify_buffer_monotone (buffer, error))
|
if (!verify_buffer_monotone (buffer, error))
|
||||||
return false;
|
return false;
|
||||||
|
@ -273,7 +273,7 @@ struct shape_options_t : option_group_t
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verify_buffer_monotone (hb_buffer_t *buffer, const char **error=NULL)
|
bool verify_buffer_monotone (hb_buffer_t *buffer, const char **error=nullptr)
|
||||||
{
|
{
|
||||||
/* Check that clusters are monotone. */
|
/* Check that clusters are monotone. */
|
||||||
if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES ||
|
if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES ||
|
||||||
|
@ -300,7 +300,7 @@ struct shape_options_t : option_group_t
|
||||||
bool verify_buffer_safe_to_break (hb_buffer_t *buffer,
|
bool verify_buffer_safe_to_break (hb_buffer_t *buffer,
|
||||||
hb_buffer_t *text_buffer,
|
hb_buffer_t *text_buffer,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
const char **error=NULL)
|
const char **error=nullptr)
|
||||||
{
|
{
|
||||||
if (cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES &&
|
if (cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES &&
|
||||||
cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS)
|
cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS)
|
||||||
|
@ -448,16 +448,16 @@ struct font_options_t : option_group_t
|
||||||
int default_font_size_,
|
int default_font_size_,
|
||||||
unsigned int subpixel_bits_)
|
unsigned int subpixel_bits_)
|
||||||
{
|
{
|
||||||
variations = NULL;
|
variations = nullptr;
|
||||||
num_variations = 0;
|
num_variations = 0;
|
||||||
default_font_size = default_font_size_;
|
default_font_size = default_font_size_;
|
||||||
subpixel_bits = subpixel_bits_;
|
subpixel_bits = subpixel_bits_;
|
||||||
font_file = NULL;
|
font_file = nullptr;
|
||||||
face_index = 0;
|
face_index = 0;
|
||||||
font_size_x = font_size_y = default_font_size;
|
font_size_x = font_size_y = default_font_size;
|
||||||
font_funcs = NULL;
|
font_funcs = nullptr;
|
||||||
|
|
||||||
font = NULL;
|
font = nullptr;
|
||||||
|
|
||||||
add_options (parser);
|
add_options (parser);
|
||||||
}
|
}
|
||||||
|
@ -490,15 +490,15 @@ struct font_options_t : option_group_t
|
||||||
struct text_options_t : option_group_t
|
struct text_options_t : option_group_t
|
||||||
{
|
{
|
||||||
text_options_t (option_parser_t *parser) {
|
text_options_t (option_parser_t *parser) {
|
||||||
text_before = NULL;
|
text_before = nullptr;
|
||||||
text_after = NULL;
|
text_after = nullptr;
|
||||||
|
|
||||||
text = NULL;
|
text = nullptr;
|
||||||
text_file = NULL;
|
text_file = nullptr;
|
||||||
|
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
gs = NULL;
|
gs = nullptr;
|
||||||
line = NULL;
|
line = nullptr;
|
||||||
line_len = (unsigned int) -1;
|
line_len = (unsigned int) -1;
|
||||||
|
|
||||||
add_options (parser);
|
add_options (parser);
|
||||||
|
@ -541,13 +541,13 @@ struct text_options_t : option_group_t
|
||||||
struct output_options_t : option_group_t
|
struct output_options_t : option_group_t
|
||||||
{
|
{
|
||||||
output_options_t (option_parser_t *parser,
|
output_options_t (option_parser_t *parser,
|
||||||
const char **supported_formats_ = NULL) {
|
const char **supported_formats_ = nullptr) {
|
||||||
output_file = NULL;
|
output_file = nullptr;
|
||||||
output_format = NULL;
|
output_format = nullptr;
|
||||||
supported_formats = supported_formats_;
|
supported_formats = supported_formats_;
|
||||||
explicit_output_format = false;
|
explicit_output_format = false;
|
||||||
|
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
|
|
||||||
add_options (parser);
|
add_options (parser);
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ struct output_options_t : option_group_t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output_file && 0 == strcmp (output_file, "-"))
|
if (output_file && 0 == strcmp (output_file, "-"))
|
||||||
output_file = NULL; /* STDOUT */
|
output_file = nullptr; /* STDOUT */
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *get_file_handle (void);
|
FILE *get_file_handle (void);
|
||||||
|
|
|
@ -37,8 +37,8 @@ struct shape_consumer_t
|
||||||
: failed (false),
|
: failed (false),
|
||||||
shaper (parser),
|
shaper (parser),
|
||||||
output (parser),
|
output (parser),
|
||||||
font (NULL),
|
font (nullptr),
|
||||||
buffer (NULL) {}
|
buffer (nullptr) {}
|
||||||
|
|
||||||
void init (hb_buffer_t *buffer_,
|
void init (hb_buffer_t *buffer_,
|
||||||
const font_options_t *font_opts)
|
const font_options_t *font_opts)
|
||||||
|
@ -58,7 +58,7 @@ struct shape_consumer_t
|
||||||
|
|
||||||
for (unsigned int n = shaper.num_iterations; n; n--)
|
for (unsigned int n = shaper.num_iterations; n; n--)
|
||||||
{
|
{
|
||||||
const char *error = NULL;
|
const char *error = nullptr;
|
||||||
|
|
||||||
shaper.populate_buffer (buffer, text, text_len, text_before, text_after);
|
shaper.populate_buffer (buffer, text, text_len, text_before, text_after);
|
||||||
if (n == 1)
|
if (n == 1)
|
||||||
|
@ -80,9 +80,9 @@ struct shape_consumer_t
|
||||||
{
|
{
|
||||||
output.finish (buffer, font_opts);
|
output.finish (buffer, font_opts);
|
||||||
hb_font_destroy (font);
|
hb_font_destroy (font);
|
||||||
font = NULL;
|
font = nullptr;
|
||||||
hb_buffer_destroy (buffer);
|
hb_buffer_destroy (buffer);
|
||||||
buffer = NULL;
|
buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue