diff --git a/src/hb-ot-tag.c b/src/hb-ot-tag.c index 4017c88fd..8f62f8499 100644 --- a/src/hb-ot-tag.c +++ b/src/hb-ot-tag.c @@ -639,10 +639,8 @@ hb_ot_tag_from_language (hb_language_t language) char tag[4]; int i; lang_str += 6; -#define IS_LETTER(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) -#define TO_UPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) + 'A' - 'a' : (c)) - for (i = 0; i < 4 && IS_LETTER (lang_str[i]); i++) - tag[i] = TO_UPPER (lang_str[i]); + for (i = 0; i < 4 && ISALPHA (lang_str[i]); i++) + tag[i] = TOUPPER (lang_str[i]); for (; i < 4; i++) tag[i] = ' '; return HB_TAG_CHAR4 (tag); diff --git a/src/hb-private.h b/src/hb-private.h index 98dc0bb97..481015cbe 100644 --- a/src/hb-private.h +++ b/src/hb-private.h @@ -263,6 +263,13 @@ typedef int hb_mutex_t; #define hb_be_uint32_cmp(a,b) (a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3]) +/* ASCII character handling */ + +#define ISALPHA(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) +#define TOUPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c)) +#define TOLOWER(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c)) + + /* Debug */ #ifndef HB_DEBUG