diff --git a/.github/generate-sbom.py b/.github/generate-sbom.py index 6fecfc29ae4..5c1b95447a7 100755 --- a/.github/generate-sbom.py +++ b/.github/generate-sbom.py @@ -162,7 +162,7 @@ def generate(version: str) -> dict: "bom-ref": f"{purl}#thirdparty/raqm", "type": "library", "name": "raqm", - "version": "0.10.5", + "version": "0.11.0", "description": "Complex text layout library " "(vendored in src/thirdparty/raqm/)", "licenses": [{"license": {"id": "MIT"}}], @@ -175,15 +175,15 @@ def generate(version: str) -> dict: "pedigree": { "ancestors": [ { - "bom-ref": "pkg:github/HOST-Oman/libraqm@0.10.5#upstream", + "bom-ref": "pkg:github/HOST-Oman/libraqm@0.11.0#upstream", "type": "library", "name": "raqm", - "version": "0.10.5", - "purl": "pkg:github/HOST-Oman/libraqm@0.10.5", + "version": "0.11.0", + "purl": "pkg:github/HOST-Oman/libraqm@0.11.0", "externalReferences": [ { "type": "distribution", - "url": "https://github.com/HOST-Oman/libraqm/releases/tag/v0.10.5", + "url": "https://github.com/HOST-Oman/libraqm/releases/tag/v0.11.0", } ], } @@ -195,10 +195,10 @@ def generate(version: str) -> dict: "text": { # raqm-version.h.in → raqm-version.h: # template @RAQM_VERSION_*@ placeholders replaced - # with literal 0.10.5 values; filename changed to - # drop the .in suffix; minor indentation fix. + # with literal 0.11.0 values; filename changed to + # drop the .in suffix. "content": upstream_diff_b64( - "https://raw.githubusercontent.com/HOST-Oman/libraqm/v0.10.5/src/raqm-version.h.in", + "https://raw.githubusercontent.com/HOST-Oman/libraqm/v0.11.0/src/raqm-version.h.in", b"src/raqm-version.h.in", thirdparty / "raqm" / "raqm-version.h", b"src/raqm-version.h", @@ -216,7 +216,7 @@ def generate(version: str) -> dict: # building without a system FriBiDi Pillow's own # fribidi-shim is used instead. "content": upstream_diff_b64( - "https://raw.githubusercontent.com/HOST-Oman/libraqm/v0.10.5/src/raqm.c", + "https://raw.githubusercontent.com/HOST-Oman/libraqm/v0.11.0/src/raqm.c", b"src/raqm.c", thirdparty / "raqm" / "raqm.c", b"src/raqm.c", @@ -227,7 +227,7 @@ def generate(version: str) -> dict: }, ], "notes": ( - "Vendored from upstream HOST-Oman/libraqm v0.10.5 with two " + "Vendored from upstream HOST-Oman/libraqm v0.11.0 with two " "Pillow-specific modifications: (1) raqm-version.h.in was " "pre-processed into raqm-version.h with version placeholders " "replaced by literal values; (2) raqm.c wraps the " diff --git a/depends/install_raqm.sh b/depends/install_raqm.sh index 8730b7d8345..f2dcb8f5278 100755 --- a/depends/install_raqm.sh +++ b/depends/install_raqm.sh @@ -2,7 +2,7 @@ # install raqm -archive=libraqm-0.10.5 +archive=libraqm-0.11.0 ./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz diff --git a/src/thirdparty/fribidi-shim/fribidi.c b/src/thirdparty/fribidi-shim/fribidi.c index 5663da86b92..7b1a8f8c51e 100644 --- a/src/thirdparty/fribidi-shim/fribidi.c +++ b/src/thirdparty/fribidi-shim/fribidi.c @@ -85,6 +85,7 @@ int load_fribidi(void) { LOAD_FUNCTION(fribidi_unicode_to_charset); LOAD_FUNCTION(fribidi_charset_to_unicode); LOAD_FUNCTION(fribidi_get_bidi_types); + LOAD_FUNCTION(fribidi_get_par_direction); LOAD_FUNCTION(fribidi_get_par_embedding_levels); #ifndef _WIN32 diff --git a/src/thirdparty/fribidi-shim/fribidi.h b/src/thirdparty/fribidi-shim/fribidi.h index 7e175c3db80..bbd3c23b98e 100644 --- a/src/thirdparty/fribidi-shim/fribidi.h +++ b/src/thirdparty/fribidi-shim/fribidi.h @@ -85,6 +85,9 @@ FRIBIDI_FUNC(FriBidiStrIndex, fribidi_charset_to_unicode, FRIBIDI_FUNC(void, fribidi_get_bidi_types, const FriBidiChar *, const FriBidiStrIndex, FriBidiCharType *); +FRIBIDI_FUNC(FriBidiParType, fribidi_get_par_direction, + const FriBidiCharType *, const FriBidiStrIndex); + FRIBIDI_FUNC(FriBidiLevel, fribidi_get_par_embedding_levels, const FriBidiCharType *, const FriBidiStrIndex, FriBidiParType *, FriBidiLevel *); diff --git a/src/thirdparty/raqm/COPYING b/src/thirdparty/raqm/COPYING index 964318a8ae7..99468479637 100644 --- a/src/thirdparty/raqm/COPYING +++ b/src/thirdparty/raqm/COPYING @@ -1,7 +1,7 @@ The MIT License (MIT) Copyright © 2015 Information Technology Authority (ITA) -Copyright © 2016-2025 Khaled Hosny +Copyright © 2016-2026 Khaled Hosny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/thirdparty/raqm/NEWS b/src/thirdparty/raqm/NEWS index 7d393eb143f..8be10bf718c 100644 --- a/src/thirdparty/raqm/NEWS +++ b/src/thirdparty/raqm/NEWS @@ -1,3 +1,21 @@ +Overview of changes leading to 0.11.0 +Thursday, July 23, 2026 +==================================== + +Update grapheme cluster boundary detection to Unicode 17, conforming to +Unicode UAX #29 and verified against the Unicode conformance test. + +Reject input that spans multiple paragraphs; raqm_layout() now fails when +the text contains a paragraph separator. + +Fix out-of-bounds read in the UTF-8 and UTF-16 decoders. + +Build, CI and documentation updates. + +New API: + * raqm_get_par_detected_direction + * raqm_allowed_grapheme_boundary + Overview of changes leading to 0.10.5 Saturday, April 11, 2026 ==================================== diff --git a/src/thirdparty/raqm/README.md b/src/thirdparty/raqm/README.md index ab729cdc036..a24c73c57c3 100644 --- a/src/thirdparty/raqm/README.md +++ b/src/thirdparty/raqm/README.md @@ -70,13 +70,6 @@ Projects using Raqm 5. [mplcairo](https://github.com/anntzer/mplcairo) 6. [CEGUI](https://github.com/cegui/cegui) -The following projects have patches to support complex text layout using Raqm: - -2. SDL_ttf: https://bugzilla.libsdl.org/show_bug.cgi?id=3211 -3. Pygame: https://bitbucket.org/pygame/pygame/pull-requests/52 -4. Blender: https://developer.blender.org/D1809 - - [1]: https://github.com/fribidi/fribidi [2]: https://github.com/Tehreer/SheenBidi diff --git a/src/thirdparty/raqm/grapheme-data.h b/src/thirdparty/raqm/grapheme-data.h new file mode 100644 index 00000000000..10be59f01cd --- /dev/null +++ b/src/thirdparty/raqm/grapheme-data.h @@ -0,0 +1,398 @@ +/* Generated by scripts/gen-grapheme-data.py from Unicode 17.0.0 */ +/* DO NOT EDIT MANUALLY */ + +#ifndef _RAQM_GRAPHEME_DATA_H_ +#define _RAQM_GRAPHEME_DATA_H_ + +typedef enum +{ + RAQM_GRAPHEME_OTHER, + RAQM_GRAPHEME_CR, + RAQM_GRAPHEME_LF, + RAQM_GRAPHEME_CONTROL, + RAQM_GRAPHEME_EXTEND, + RAQM_GRAPHEME_ZWJ, + RAQM_GRAPHEME_REGIONAL_INDICATOR, + RAQM_GRAPHEME_PREPEND, + RAQM_GRAPHEME_SPACING_MARK, + RAQM_GRAPHEME_L, + RAQM_GRAPHEME_V, + RAQM_GRAPHEME_T, + RAQM_GRAPHEME_LV, + RAQM_GRAPHEME_LVT, + RAQM_GRAPHEME_EXTENDED_PICTOGRAPHIC +} _raqm_grapheme_t; + +typedef enum +{ + RAQM_INCB_NONE, + RAQM_INCB_CONSONANT, + RAQM_INCB_LINKER, + RAQM_INCB_EXTEND +} _raqm_incb_t; + +#include + +static const uint8_t _raqm_u8[4446]= +{ + 33, 0, 48, 84,118,128,144,186, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 0, 19, 20, 21, 22, 0, 23, 24, 25, 26, 27, 28, 29, + 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 33, 34, 2, + 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, + 5, 6, 7, 8, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 0, 37, 38, 39, 0, 0, 0, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 53, 54, + 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, + 57, 58, 59, 0, 0, 0, 60, 0, 0, 61, 62, 63, 64, 65, 0, 0, + 0, 66, 67, 68, 69, 70, 71, 72, 73, 74, 1, 1, 1, 1, 1, 1, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 3, + 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, + 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, + 8, 9, 3, 4, 5, 6, 7, 8, 9, 18, 11, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 10, 20, 0, 0, 0, 0, 21, 0, 0, 0, 22, + 23, 24, 25, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 12, 39, 12, 40, 41, 42, 43, 44, 45, 46, 47, 48, 13, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 0, 63, 64, 65, + 66, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 68, 69, 70, + 71, 72, 0, 73, 0, 74, 0, 0, 0, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 0, 0, 84, 0, 0, 0, 10, 85, 86, 0, 87, 88, 0, 89, + 0, 0, 0, 0, 0, 90, 0, 0, 91, 0, 0, 0, 92, 0, 0, 93, + 94, 95, 96, 97, 98, 99,100,101, 0, 0, 0, 0, 0,102, 0, 0, + 0, 0, 0, 0, 0,103,104, 0, 0, 0, 0, 0,105, 0,106, 0, + 107,108, 0,109, 0, 0, 0, 0, 0, 0, 0,110, 0, 0, 0, 0, + 0, 0,111, 14,112, 0, 0, 0, 0,113, 0,114,115,116,117,118, + 119,120,121,122,123, 0, 0, 0,124, 3, 4, 5, 6, 7, 8,125, + 126, 0, 0, 0, 0,127, 0, 0, 0,128, 0, 0, 11, 0, 0, 14, + 129, 0, 0, 0, 0, 0, 0, 0,130, 0, 0, 0,131, 0,132, 0, + 0,133, 0, 0,134, 0, 0, 0, 0, 0, 0, 0, 0,135,136, 0, + 0, 0, 0,137,138, 0,139,140, 0,141,142,143,144,145,146,147, + 148,149,150, 0,151, 13,152,153,154,155,156,157,158, 0, 0,159, + 160,161,162,163, 0,164, 0, 0, 0,165, 0, 0, 0,166,167, 0, + 168,169,170,171, 0, 0,172, 0, 0,173, 0,174, 0,175,176,177, + 0, 0, 0, 0,178,179,180, 0, 0,181,182, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,183, 0, 0, 0, 0, 0, 0,184, 15, 0, 0, + 0, 0, 0, 0, 0, 0,185, 0, 0, 0, 0, 0, 0, 0,186,187, + 188, 0, 0,189, 0, 0, 0, 0, 0, 0, 0, 0, 0,190,191, 0, + 0, 0, 0, 0, 0, 0,192,193, 0, 0,194, 0, 0, 0, 0, 0, + 0,195,196,197, 0, 0, 0, 0, 0,198, 0,199, 0, 15, 0, 0, + 0, 0, 0,200, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, + 201, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0,203, 0,204, 0, + 0,205, 0,206,207, 0,208,209,210,211,212, 2, 2,213, 2,214, + 215, 2, 2, 2,216, 17,217,218,219, 2,220, 2,221, 0, 0, 0, + 222,223,224,225,226,227,228, 2, 2, 0,229, 2, 2, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 17,230, 10, 1, 1, 10, 10, 10,231, 0, 0, 0, 0, 1, 1, 1, + 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 1, 1, 1, 1, 1, 1, + 4, 1, 1, 4, 1, 1, 4, 1, 1, 5, 5, 5, 5, 9, 0, 0, + 0, 7, 0, 0, 0, 10, 10, 10, 10, 8, 8, 8, 8, 0, 0, 0, + 6, 0, 6, 0, 0, 16, 16, 16, 16, 5, 12, 0, 0, 0, 0, 6, + 5, 19, 0, 0, 0, 0, 0, 7, 5, 47, 0, 0, 0, 0, 0, 0, + 20, 0, 29, 0, 0, 0, 0, 0, 7, 0, 0, 0, 3, 49, 0, 0, + 0, 0, 0, 0, 18, 0, 0, 24, 3, 13, 0, 0, 0, 11, 0, 0, + 0, 0, 19, 0, 0, 12, 0, 0, 0, 5, 9, 0, 0, 0, 0, 0, + 17, 0, 0, 3, 3, 0, 0, 0, 52, 14, 5, 5, 5, 0, 7, 5, + 5, 5, 0, 0, 19, 26, 0, 0, 0, 27, 56, 48, 38, 57, 0, 0, + 0, 0, 0, 0, 46, 0, 0, 0, 31, 23, 0, 0, 0, 0, 0, 6, + 55, 5, 5, 5, 9, 0, 0, 0, 14, 0, 0, 0, 19, 7, 11, 0, + 0, 7, 9, 0, 0, 5, 5, 5, 11, 5, 0, 0, 0, 0, 0, 22, + 0, 28, 0, 0, 0, 0, 0, 40, 0, 0, 0, 17, 0, 18, 13, 0, + 0, 0, 24, 0, 0, 13, 0, 0, 18, 0, 0, 0, 32, 15, 15, 15, + 15, 0, 9, 0, 0, 0, 0, 0, 5, 0, 17, 3, 3, 3, 3, 3, + 21, 0, 0, 17, 3, 2, 2, 79, 80, 0, 0, 22, 81, 6, 5, 11, + 0, 5, 5, 5, 36, 29, 36, 0, 0, 64, 65, 0, 0, 5, 5, 12, + 82, 0, 7, 5, 83, 5, 37, 31, 11, 0, 0, 0, 84, 5, 5, 12, + 0, 0, 7, 36, 5, 5, 14, 14, 11, 0, 0, 14, 0, 65, 6, 5, + 5, 66, 5, 5, 5, 0, 0, 53, 46, 27, 5, 33, 54, 14, 5, 0, + 0, 0, 0, 0, 55, 34, 6, 37, 11, 11, 19, 0, 0, 27, 36, 85, + 38, 0, 14, 0, 0, 20, 0, 0, 0, 0, 0, 0, 53, 58, 35, 67, + 38, 33, 9, 0, 0, 33, 68, 31, 11, 0, 0, 0, 69, 59, 68, 31, + 11, 39, 0, 0, 0, 27, 46, 67, 86, 0, 0, 20, 6, 30, 60, 15, + 32, 35, 0, 0, 0, 70, 5, 12, 0, 0, 6, 5, 12, 70, 5, 5, + 9, 0, 0, 5, 12, 0, 0, 11, 0, 0, 71, 19, 35, 14, 5, 5, + 26, 5, 31, 0, 14, 5, 5, 14, 5, 0, 20, 0, 0, 43, 5, 57, + 34, 0, 35, 11, 7, 14, 9, 0, 0, 20, 34, 0, 19, 16, 16, 8, + 8, 0, 44, 5, 23, 15, 72, 27, 5, 0, 0, 6, 87, 0, 0, 19, + 0, 26, 32, 33, 0, 72, 15, 27, 0, 0, 6, 61, 0, 0, 88, 5, + 12, 60, 14, 5, 33, 32, 5, 5, 37, 5, 5, 5, 0, 5, 73, 0, + 0, 0, 5, 5, 23, 30, 9, 0, 0, 74, 23, 5, 11, 0, 53, 23, + 50, 0, 15, 15, 5, 5, 30, 0, 0, 12, 5, 5, 5, 43, 5, 9, + 19, 0, 56, 11, 0, 0, 0, 52, 89, 0, 0, 2, 90, 0, 0, 0, + 13, 0, 3, 21, 0, 0, 0, 13, 0, 3, 0, 25, 0, 0, 28, 0, + 0, 0, 0, 18, 25, 3, 13, 0, 28, 22, 21, 13, 22, 91, 28, 28, + 17, 0, 0, 25, 0, 62, 0, 3, 3, 3, 0, 0, 18, 45, 40, 13, + 0, 0, 0, 18, 17, 17, 3, 51, 13, 21, 18, 17, 0, 21, 0, 0, + 40, 0, 21, 13, 17, 51, 13, 0, 0, 3, 41, 25, 22, 28, 22, 3, + 41, 28, 62, 0, 22, 22, 0, 13, 0, 0, 45, 0, 62, 18, 41, 0, + 0, 22, 0, 0, 0, 0, 21, 0, 0, 0, 0, 18, 13, 13, 22, 0, + 0, 13, 0, 0, 22, 0, 0, 29, 0, 0, 18, 22, 0, 12, 5, 5, + 11, 20, 20, 6, 0, 39, 75, 0, 9, 92, 0, 0, 0, 0, 15, 15, + 15, 15, 11, 0, 0, 11, 0, 0, 6, 0, 7, 5, 11, 0, 6, 5, + 5, 44, 0, 0, 0, 10, 10, 10, 93, 6, 30, 23, 23, 0, 0, 14, + 26, 75, 34, 0, 0, 6, 0, 0, 94, 0, 0, 0, 9, 31, 37, 9, + 7, 0, 0, 39, 23, 0, 95, 0, 0, 39, 54, 58, 38, 1, 0, 0, + 0, 16, 76, 96, 8, 8, 8, 8, 0, 2, 2, 2, 0, 0, 7, 12, + 0, 14, 29, 0, 5, 0, 0, 12, 6, 0, 5, 0, 0, 0, 0, 14, + 11, 0, 0, 6, 9, 97, 0, 0, 0, 0, 0, 5, 5, 37, 9, 0, + 6, 32, 26, 34, 77, 20, 0, 0, 77, 0, 6, 5, 27, 0, 98, 0, + 0, 6, 0, 0, 0, 39, 30, 5, 26, 99, 0, 14, 69, 23, 5, 0, + 20, 32, 5, 12, 0, 33, 48, 48, 38, 35, 7, 5, 9, 0, 0, 61, + 5, 60, 71, 49, 30,100, 0, 0, 0, 29, 0, 0, 0, 0, 63, 5, + 5, 30,101, 0, 0, 61, 5, 59, 50, 43, 0, 0, 0, 30, 11, 15, + 44, 0, 0, 0, 11, 32, 5, 26, 50, 0, 0, 6, 54, 5, 5, 0, + 0, 0, 0, 0,102, 7, 44, 5, 0, 5, 5, 34, 0, 33,103,104, + 105,106, 0, 0, 0, 63, 5, 7, 15, 9, 73, 0, 0, 14, 5, 12, + 0, 6, 5,107, 12, 14, 26, 27, 0, 0, 64,108, 5, 5, 26, 11, + 0, 43, 59, 0, 0, 0, 0, 0, 39, 5, 12, 5, 44, 7, 5, 5, + 5, 5, 5, 74, 5, 43, 34, 0, 0, 14, 12, 20, 36, 5, 66, 0, + 0, 0, 0, 35,109,110, 50, 0, 0, 6, 58, 0, 0,111, 0, 0, + 0, 0, 30, 12, 35, 0, 0, 20, 0, 9, 6, 5, 5, 5, 11, 0, + 0, 5, 5, 23, 27, 78, 78, 76, 0, 63, 15, 15, 15, 15, 15, 0, + 6, 0, 0, 0, 29, 2, 0, 0, 0, 0, 14, 11, 14,112, 2,113, + 5, 12, 14, 5, 0, 0, 0, 7, 11, 5, 12, 6, 5, 5, 12, 5, + 5, 5, 5, 37, 5, 36, 31, 12, 0, 6, 20, 0, 7, 0, 5, 12, + 0, 0, 13, 0, 0, 0, 3, 3, 3, 21, 0, 0, 17, 0, 0, 0, + 28, 24, 3, 25, 0, 3,114, 42, 42, 42, 42, 42, 42, 24, 3, 3, + 3, 0, 0, 28, 0, 17, 3, 25, 3, 21, 3, 3, 3, 3, 17, 24, + 17, 45, 41,115, 5, 3, 3, 3, 41, 0, 0, 24, 25, 3, 3, 0, + 18, 45, 3, 25, 0, 0, 18, 17, 21, 13, 40, 0, 0, 0, 21, 13, + 0, 40, 0, 0, 13, 17, 13, 0, 0, 24, 0, 0, 25, 51, 0, 13, + 18, 18, 0, 17, 3, 3, 21, 18, 3, 25, 24, 3, 3, 3, 21, 51, + 3, 45, 3, 3, 3, 17, 3, 3, 3, 3, 3, 25, 3, 3, 41, 3, + 3, 0, 0,221,221, 51, 51,238,238,220,221, 68, 68, 0, 64, 0, + 68,187,187, 4, 0,153,153, 68, 0, 68, 4, 14, 0, 64, 68,136, + 136,170,170, 0,238, 0,224, 64, 0, 0, 4,238, 0,224, 0, 68, + 136,224,238,238, 14, 68,132, 72, 68, 0, 14, 64, 4,136, 68, 4, + 68,136, 72,132,136, 72, 4, 0,136, 68, 64, 4, 64, 72, 0, 0, + 128,224, 14,238,224,102,102,132, 68, 68, 72, 14,224, 4,136, 64, + 136, 8,128, 68, 8, 72, 72,224,224, 0, 48, 0,132, 72,136, 4, + 132, 4,128, 64,132,132, 8,132,132, 4, 4,132, 72, 14, 14,128, + 136,119,119,119, 0, 68, 71, 8,136, 8, 68, 4, 72, 64,128, 64, + 64,136,132, 8, 0,128, 68, 72,132,170, 10,112, 0, 0,160, 51, + 50, 19, 51, 48, 14, 3, 0,116, 64, 0,112,132,128, 72, 7, 68, + 67,128,132, 84, 51, 51, 3, 14,238,136, 0, 9, 0,132, 0,128, + 4, 0,176, 72, 8,128, 8, 4,119,116, 4,132, 4, 64, 72,136, + 128, 8, 64, 68,116,120, 72,132, 64,119, 68,136, 8, 68,128, 68, + 135, 68, 52, 51, 67,238,102,238, 78, 33, 0, 48, 64,101,112,128, + 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, + 13, 0, 14, 0, 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, + 0, 21, 22, 23, 0, 0, 0, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, + 0, 0, 36, 0, 0, 0, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 39, 0, 0, 0, 0, 0, 0, 0, 0, 40, 41, 42, 0, 0, 0, 43, + 0, 0, 44, 45, 46, 47, 48, 0, 0, 0, 0, 49, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 8, 0, 0, 0, 0, 9, 0, 0, 0, 10, 11, 12, 13, + 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 2, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 54, 55, 56, 57, 58, 0, + 59, 0, 60, 0, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, + 0, 70, 0, 0, 0, 1, 71, 0, 0, 72, 0, 0, 0, 0, 0, 0, + 0, 73, 0, 74, 0, 3, 75, 0, 76, 0, 0, 0, 0, 0, 0, 77, + 4, 78, 0, 0, 0, 0, 79, 0, 0, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 0, 0, 0, 89, 0, 0, 0, 0, 90, 0, 0, 0, 91, 0, + 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, + 0, 93, 0, 94, 0, 0, 95, 0, 0, 96, 0, 0, 0, 0, 0, 0, + 0, 0, 97, 98, 0, 0, 0, 0, 99,100, 0,101,102, 0,103,104, + 105,106,107,108,109,110,111, 2, 0,112,113,114,115,116,117,118, + 119,120, 0, 0,121,122,123,124,125, 0,126, 0, 0, 0,127, 0, + 0, 0,128,129, 0,130,131,132,133, 0, 0,134, 0, 0,135, 0, + 136, 0,137,138,139, 0, 0, 0, 0,140,141,142, 0, 0, 0,143, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,144, 0, 0, 0, 0, 0, + 0,145, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6,146,147, 0, 0, + 148, 0, 0, 0, 0, 0, 0, 0, 0, 0,149,150, 0, 0, 0, 0, + 0, 0, 0,151,152, 0, 0,153, 0, 0, 0, 0, 0, 0,154,155, + 156, 0, 0, 0, 0, 0,157, 0, 6, 0, 5, 0, 0, 0, 0, 0, + 158, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,159, 0, 0, + 0,160, 0, 0, 0, 0, 0, 0, 0,161, 0,162, 0, 0, 0, 0, + 0, 0, 0, 0, 0,163, 3, 1, 0, 0, 1, 1, 1, 1, 0, 0, + 0, 0, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 1, 1, 0, 13, + 0, 0, 0, 0, 0, 10, 3, 0, 0, 0, 0, 0, 20, 0, 1, 1, + 1, 0, 38, 0, 0, 0, 0, 21, 1, 39, 40, 0, 0, 0, 0, 22, + 0, 0, 9, 1, 0, 6, 0, 41, 42, 0, 0, 4, 0, 1, 22, 0, + 0, 0, 0, 0, 23, 6, 0, 0, 9, 43, 0, 44, 45, 0, 0, 46, + 0, 0, 0, 24, 0, 0, 14, 1, 47, 1, 25, 8, 2, 48, 49, 50, + 5, 51, 4, 8, 11, 52, 15, 53, 5, 54, 16, 0, 0, 55, 56, 4, + 0, 57, 16, 8, 11, 58, 59, 0, 5, 60, 4, 8, 11, 61, 15, 62, + 5, 63, 26, 0, 0, 12, 27, 17, 0, 0, 64, 8, 11, 65, 66, 67, + 5, 0, 4, 0, 0, 68, 69, 18, 5, 0, 7, 8, 2, 70, 15, 17, + 5, 0, 71, 72, 0, 0, 0, 0, 0, 73, 74, 0, 0, 0, 0, 0, + 0, 75, 76, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 79, 80, 81, + 1, 28, 82, 0, 0, 0, 2, 2, 83, 84, 0, 85, 86, 87, 88, 19, + 0, 0, 0, 89, 0, 0, 0, 29, 0, 30, 0, 5, 0, 5, 2, 2, + 2, 90, 91, 92, 0, 0, 93, 0, 0, 0, 18, 0, 94, 0, 0, 0, + 95, 96, 0, 97, 2, 2, 2, 98, 99,100, 0, 0, 0, 1, 1, 31, + 101, 0,102,103, 2,104,105, 0, 9, 32,106, 2,107,108, 0, 0, + 109, 32, 0, 0, 20,110, 0,111,112,113, 19, 0, 0, 0, 0, 1, + 1, 6, 0, 0, 3, 7, 0, 0, 0, 3, 0, 0, 14, 0, 0,114, + 0, 0, 0, 0, 3,115, 0, 0, 0, 7,116, 0,117, 0,118, 0, + 1,119, 0, 0,120, 0, 24,121, 0, 0,122, 2, 2,123,124, 0, + 125,126, 0, 0,127,128,129, 0, 2,130, 0, 0, 0,131, 4, 0, + 132,133, 2,134,135, 0, 0, 12, 0, 0, 1, 0, 1, 0, 0, 0, + 0, 19, 0, 0, 6, 0, 0, 0, 0,136,137,138, 2,139, 0, 0, + 18, 0, 0, 0,140, 0, 0, 0,141, 0, 0, 0,142, 0, 0, 0, + 0, 14, 23, 6, 0, 0, 29, 0, 0, 0, 4, 0, 0, 33, 10, 0, + 0,143, 7, 0, 0,144, 26, 0, 0, 0,145, 2,146,147,148, 0, + 0, 34, 7, 0, 0,149,150, 0, 0, 0, 0, 0, 3,151, 0, 3, + 152, 0, 7, 0, 0,153, 27, 17,154, 35,155, 2, 2,156,157,158, + 16, 0, 0, 0, 0, 33,159, 12, 0, 0, 0, 0, 0,160,161, 0, + 0, 0, 0, 0, 3,162, 6,163, 0, 0, 0, 0, 0,164, 6, 0, + 0, 0, 0, 0,165,166, 0,167,168, 0, 0, 0, 3,169,170,171, + 2,172, 34, 0, 0, 0, 0,173, 6, 0,174, 2, 2,175,176,177, + 2, 2,178,179, 0, 0, 0, 0,180, 0, 0, 0, 0,181, 0,182, + 183,184, 0, 0, 0,185,186, 0, 0, 0, 0,187, 0, 0, 0, 0, + 0,188,189,190, 2,191,192,193, 0, 0,194,195, 0, 0, 0, 13, + 196, 0, 0, 0, 0, 35, 3, 25, 0, 0, 0, 0, 36, 7, 0,197, + 0, 0, 1, 1, 31, 1, 10, 0, 0, 0, 0, 0,198,199,200, 0, + 201, 0, 30, 0, 0, 0, 1, 1, 1,202, 1, 1, 28, 37, 36, 9, + 21, 0,203,204,205, 0, 0, 0, 12, 0, 0, 0, 13, 0, 0, 0, + 206, 37, 0, 10, 0, 0,207, 0, 0, 0, 0, 0, 0, 9, 0, 0, + 0, 0,255,255,255,255, 85, 85, 85, 85, 0, 0, 0,192, 12, 0, + 0, 0,240, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 0, 84, + 85, 85, 0, 0,192,255,255, 63, 0, 0, 85, 85, 81, 85, 0, 0, + 0, 48, 0, 0, 0,240, 0, 0,240,255,252, 3, 0, 8, 60, 0, + 0, 0, 0,192, 0, 0, 0, 60, 0, 0, 0, 0, 0, 12, 0, 0, + 0,255,252,255,255,255,255,255, 63, 0, 0,240,255,255, 0,192, + 255,255, 63, 0, 0, 0, 48, 0, 0, 0, 3, 0, 0, 12,255,255, + 255, 3,240, 15, 0, 0,240, 3, 0, 0,255,255,255, 15,255, 0, + 0, 0, 0, 0,255,255,192, 0, 0, 0,255, 3, 0, 0, 0, 3, + 0, 0, 0, 12, 0, 0,192,255, 15, 0,255,255,255,207, 60,207, + 0, 0, 0,240,255,195,255,195,243, 15,255, 0, 0, 12, 0,240, + 207,255,255,252,252, 15, 0, 0,252, 0,207,255,255,255, 85, 85, + 53, 3,252,255, 3, 8,252,255, 85, 85, 0, 0, 85, 85, 17, 80, + 5, 51, 0,192, 0, 69, 5, 0, 0, 48, 0, 0, 0, 3, 60,192, + 195, 15, 15, 12, 0, 0, 81, 84, 5, 3,252,207, 3, 8, 0, 0, + 244,255, 81, 84, 5,243, 0,252, 0, 69, 4, 0, 0, 0, 3, 3, + 0, 0, 85, 85, 5,243, 3,240,243, 11, 0, 60, 21, 0, 0, 0, + 0,195, 51,240,243, 15, 85, 85,213, 51, 0, 0, 48,192,240, 51, + 0,192, 12,255, 63, 0, 0,192,255, 63, 12,255,255, 3, 0, 0, + 255, 63, 0, 0, 15, 0, 0,204, 12, 0,252,255,255, 63,255,243, + 0,252,255,255,252,255, 0, 48, 0, 0, 85, 85, 21,252,243,255, + 56,124, 85, 5, 95,245, 7, 20, 0, 80,253, 87, 85, 85, 53, 60, + 0, 28, 0, 0, 0,252, 85,207,255, 15, 0, 48,252,255,239, 0, + 0, 12, 0, 0,192,207, 0, 0, 12, 0, 63,192, 3, 0, 48, 0, + 252, 0, 0,192,195, 0, 85, 49,255, 63, 50,252,255, 3,192,255, + 255,195,255,255,255, 0,255, 0, 64, 1, 64, 85, 85, 85, 85,255, + 255, 15,240, 86, 85, 1, 79, 85, 85, 85,241, 15,191, 95, 0, 0, + 64, 5, 0, 48, 15,204,255,240, 0, 0, 63,255,255,255,243,255, + 3, 12, 0, 3, 15, 0, 0, 0, 60, 0, 63,255,255, 15, 48, 48, + 192, 0, 0, 60, 0, 3, 0, 15, 0, 0, 15, 0, 0,192, 0,240, + 255, 15,207, 0, 0, 0, 63, 0, 84, 64,213,240, 15, 15, 2, 0, + 0, 0, 85, 77, 85, 85, 0, 0, 80, 21, 0, 0,252, 63, 60, 60, + 0, 0,192, 0, 0, 3, 84, 0, 16, 83,243,195, 3,240, 85, 85, + 21, 15, 0, 32, 0, 0, 85, 85, 21, 0, 0, 12, 3, 12, 0,240, + 63, 0,253, 60, 0,255, 85, 84, 84, 85, 85, 5, 63,128, 0,255, + 0, 0, 0, 0,252, 15, 0, 0,192, 3,195, 3, 0,192,192, 63, + 60, 0,127, 85, 85, 85, 85,213,255,252,191, 3, 0, 0, 0, 65, + 0, 0, 0,240,255, 63, 3, 0,252,195, 15,255, 0, 48,192,255, + 63, 0, 0, 0,192, 51, 0,240,255, 3, 85, 85, 69, 16, 85, 5, + 195,255, 51,204, 15,240, 50, 0, 0, 0,240, 51, 0, 0,195,255, + 51,204,243, 0, 0, 0,240, 15, 0,207, 0, 0, 0, 15,192,255, + 63,204, 0, 0,192, 12,255,255, 0, 0, 0, 0, 0,204,240,207, + 255, 0,255,255, 60, 0, 85, 21, 4, 85, 85, 20, 85, 85, 3, 0, + 192, 47, 0,255,240, 0,253,255,127, 85,213,255,195, 63, 0,128, + 0, 0,253, 63,252, 85, 85, 0,240,255,255, 63, 11, 0,243, 51, + 0, 0,255, 63,255,207,240,255,255,255,255,255,240,255,243, 60, + 0, 0,252, 63, 48,207,255,207, 0, 0, 15,204, 0, 0,192, 3, + 0, 0, 15, 85, 85, 85, 81, 85, 85, 85, 85,240, 63, 0, 47, 0, + 0, 0, 0, 0, 48, 0, 3,192,255,255,255, 15, 0, 0,255,255, + 15,252, 0, 0, 0, 60, 0,252, 15,252, 63, 0,192,255, 63,252, + 255, 0, 0, 0,240, 15,255, 63,192,255,255, 63,255,255,255,255, + 195,255,207,243, 63, 0,192, 48, 0,240, 0,255, 63, 0, +}; +static const uint16_t _raqm_u16[928]= +{ + 0, 0, 0, 0, 8, 8, 8, 8, 12, 12, 12, 12, 16, 20, 4, 24, + 4, 28, 4, 16, 20, 4, 24, 4, 28, 4, 16, 20, 4, 24, 4, 28, + 4, 16, 20, 4, 24, 4, 28, 4, 32, 32, 32, 32, 0, 0, 0, 140, + 164, 0, 0, 168, 176, 0, 0, 180, 0, 92, 0, 0, 0, 0, 0, 64, + 0, 0, 252, 0, 12, 12, 12, 260, 268, 8, 0, 0, 8, 8, 272, 0, + 32, 32, 32, 0, 276, 0, 0, 0, 0, 144, 32, 280, 284, 0, 0, 0, + 288, 292, 0, 0, 68, 32, 0, 36, 0, 296, 300, 0, 304, 72, 0, 32, + 308, 0, 0, 0, 0, 0, 148, 36, 0, 0, 68, 152, 0, 312, 316, 0, + 0, 320, 0, 0, 0, 324, 0, 0, 76, 32, 328, 32, 156, 0, 0, 332, + 336, 340, 40, 0, 80, 0, 0, 344, 160, 56, 40, 84, 348, 72, 0, 352, + 356, 0, 40, 76, 80, 0, 0, 172, 160, 360, 40, 0, 364, 0, 0, 368, + 372, 56, 0, 0, 376, 0, 0, 172, 380, 88, 40, 0, 80, 0, 0, 384, + 388, 88, 40, 392, 396, 56, 40, 0, 80, 0, 0, 0, 400, 404, 0, 408, + 0, 0, 0, 412, 416, 0, 0, 0, 0, 0, 0, 420, 424, 0, 0, 0, + 0, 428, 0, 432, 0, 0, 0, 436, 440, 444, 32, 184, 448, 0, 0, 0, + 0, 0, 188, 452, 0, 456, 36, 460, 464, 192, 0, 0, 44, 44, 44, 44, + 44, 44, 60, 60, 60, 60, 468, 48, 48, 48, 48, 48, 0, 188, 0, 0, + 0, 196, 0, 200, 0, 40, 0, 40, 0, 0, 0, 472, 476, 152, 0, 0, + 480, 0, 0, 0, 88, 0, 484, 0, 0, 0, 488, 492, 0, 496, 0, 0, + 0, 500, 504, 508, 0, 0, 0, 32, 32, 204, 512, 0, 516, 0, 0, 520, + 524, 0, 68, 208, 100, 0, 528, 0, 0, 0, 532, 208, 0, 0, 536, 540, + 0, 544, 548, 552, 556, 0, 560, 564, 212, 0, 8, 0, 0, 32, 32, 36, + 0, 0, 216, 212, 0, 568, 220, 0, 0, 224, 572, 0, 104, 0, 108, 576, + 216, 0, 0, 0, 0, 0, 224, 580, 112, 0, 0, 584, 588, 592, 596, 600, + 604, 608, 612, 616, 0, 620, 624, 628, 632, 636, 220, 640, 644, 648, 652, 228, + 656, 660, 228, 0, 0, 232, 664, 236, 0, 0, 0, 668, 232, 672, 0, 0, + 0, 676, 0, 0, 0, 0, 52, 116, 0, 0, 0, 52, 0, 0, 32, 32, + 0, 0, 76, 680, 0, 684, 0, 0, 0, 688, 0, 0, 0, 0, 52, 692, + 0, 0, 0, 116, 696, 0, 700, 0, 704, 0, 0, 708, 712, 0, 32, 716, + 0, 0, 720, 0, 724, 728, 44, 732, 156, 0, 0, 736, 36, 0, 120, 0, + 0, 0, 740, 744, 748, 0, 0, 752, 0, 0, 0, 756, 72, 0, 760, 764, + 0, 0, 768, 0, 24, 4, 772, 60, 776, 48, 48, 780, 0, 84, 0, 0, + 32, 0, 32, 0, 0, 0, 0, 784, 0, 0, 0, 192, 0, 0, 36, 0, + 0, 0, 0, 788, 792, 0, 0, 796, 0, 0, 88, 0, 0, 0, 800, 0, + 0, 0, 804, 0, 0, 0, 808, 0, 0, 0, 0, 76, 148, 36, 0, 0, + 196, 0, 0, 0, 812, 0, 0, 816, 64, 0, 0, 820, 100, 0, 0, 824, + 828, 0, 0, 0, 124, 0, 832, 128, 836, 0, 0, 840, 100, 0, 0, 844, + 848, 0, 0, 0, 0, 0, 240, 852, 72, 0, 0, 0, 0, 52, 856, 0, + 860, 56, 864, 128, 0, 0, 0, 868, 872, 876, 880, 0, 0, 0, 0, 884, + 888, 84, 0, 0, 0, 0, 0, 892, 896, 0, 0, 0, 0, 0, 52, 900, + 36, 904, 0, 0, 0, 0, 0, 908, 36, 0, 0, 0, 0, 0, 912, 916, + 0, 920, 924, 0, 0, 0, 240, 928, 0, 0, 0, 932, 936, 0, 0, 0, + 0, 940, 944, 0, 948, 0, 0, 952, 56, 956, 0, 0, 960, 964, 0, 0, + 0, 0, 968, 0, 0, 0, 972, 976, 0, 980, 984, 988, 0, 0, 0, 992, + 996, 0, 0, 0,1000,1004, 0, 0, 0, 0, 0,1008,1012, 0, 0,1016, + 124,1020, 0, 0, 0, 0, 0, 8,1024,1028, 0, 0, 0, 92,1032, 0, + 0, 0, 0, 128, 0, 0,1036, 0, 52,1040, 244, 244,1044, 124, 0, 0, + 0, 0, 248, 116, 0,1048,1052, 0, 32, 32, 204, 32, 64, 0, 0, 0, + 0, 0,1056,1060,1064, 0,1068, 0, 200, 0, 0, 0, 32, 32, 32,1072, + 32, 32, 184, 120, 248, 68, 144, 0,1076,1080,1084, 0, 52, 0, 0, 0, + 0, 0, 84, 0, 0, 0, 92, 0, 0, 0,1088, 120, 0, 64, 0, 0, + 1092, 0, 0, 0,1096, 0, 96, 0, 0,1100, 104, 112, 236, 112, 0, 256, + 0, 0, 0,1104,1108,1112, 132, 12, 12, 12,1116,1120,1124,1128, 104,1132, + 108, 12, 256, 12, 12, 12,1136, 12, 12,1140, 12, 12, 12, 12, 12,1144, + 12, 12, 12,1148,1152, 12,1156,1160,1164,1168,1172,1176,1180,1184,1188,1192, + 12, 0, 0, 0,1196,1200,1204,1208, 0, 264, 12, 12, 96, 0, 0, 0, + 136, 264, 0, 0, 136, 0, 132, 96,1212, 108, 12, 12, 96, 12, 12,1216, + 1220, 12, 12, 12, 0, 136, 132, 12, 8, 8, 32, 32, 32, 32, 32, 8, +}; + +static inline uint8_t _raqm_b4 (const uint8_t* a, unsigned i) +{ + return (a[i>>1]>>((i&1)<<2))&15; +} +static inline uint8_t _raqm_get_grapheme_break (unsigned u) +{ + /* packtab: [2^4,2^4,2^3,2^2,2^2,2^2] */ + return u<921600u ? (uint8_t)(_raqm_b4(_raqm_u8+2081u,((_raqm_u8[857u+_raqm_u16[((_raqm_u8[257u+((_raqm_u8[57u+((_raqm_b4(_raqm_u8,((((((((((u)>>2))>>2))>>2))>>3))>>4)))<<4)+((((((((((u)>>2))>>2))>>2))>>3))&15)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)]+((((u)>>2))&3)])<<2)+((u)&3))) : 0; +} +static inline uint8_t _raqm_b2 (const uint8_t* a, unsigned i) +{ + return (a[i>>2]>>((i&3)<<1))&3; +} +static inline uint8_t _raqm_get_incb (unsigned u) +{ + /* packtab: [2^4,2^4,2^3,2^2,2^4] */ + return u<918000u ? (uint8_t)(_raqm_b2(_raqm_u8+3614u,((_raqm_u8[2958u+((_raqm_u8[2550u+((_raqm_u8[2370u+((_raqm_b4(_raqm_u8+2313u,((((((((u)>>4))>>2))>>3))>>4)))<<4)+((((((((u)>>4))>>2))>>3))&15)])<<3)+((((((u)>>4))>>2))&7)])<<2)+((((u)>>4))&3)])<<4)+((u)&15))) : 0; +} + +#endif /* _RAQM_GRAPHEME_DATA_H_ */ diff --git a/src/thirdparty/raqm/raqm-version.h b/src/thirdparty/raqm/raqm-version.h index 9908f06bda7..2b584fcc717 100644 --- a/src/thirdparty/raqm/raqm-version.h +++ b/src/thirdparty/raqm/raqm-version.h @@ -32,13 +32,13 @@ #define _RAQM_VERSION_H_ #define RAQM_VERSION_MAJOR 0 -#define RAQM_VERSION_MINOR 10 -#define RAQM_VERSION_MICRO 5 +#define RAQM_VERSION_MINOR 11 +#define RAQM_VERSION_MICRO 0 -#define RAQM_VERSION_STRING "0.10.5" +#define RAQM_VERSION_STRING "0.11.0" #define RAQM_VERSION_ATLEAST(major,minor,micro) \ - ((major)*10000+(minor)*100+(micro) <= \ - RAQM_VERSION_MAJOR*10000+RAQM_VERSION_MINOR*100+RAQM_VERSION_MICRO) + ((major)*10000+(minor)*100+(micro) <= \ + RAQM_VERSION_MAJOR*10000+RAQM_VERSION_MINOR*100+RAQM_VERSION_MICRO) #endif /* _RAQM_VERSION_H_ */ diff --git a/src/thirdparty/raqm/raqm.c b/src/thirdparty/raqm/raqm.c index 88bbbfd5ebb..36ff187499f 100644 --- a/src/thirdparty/raqm/raqm.c +++ b/src/thirdparty/raqm/raqm.c @@ -47,6 +47,7 @@ #include #include "raqm.h" +#include "grapheme-data.h" /** * SECTION:raqm @@ -158,12 +159,14 @@ #ifdef RAQM_TESTING # define RAQM_TEST(...) printf (__VA_ARGS__) +# define RAQM_STATIC # define SCRIPT_TO_STRING(script) \ char buff[5]; \ hb_tag_to_string (hb_script_to_iso15924_tag (script), buff); \ buff[4] = '\0'; #else # define RAQM_TEST(...) +# define RAQM_STATIC static #endif #define RAQM_BIDI_LEVEL_IS_RTL(level) \ @@ -230,10 +233,6 @@ static size_t _raqm_encoding_to_u32_index (raqm_t *rq, size_t index); -static bool -_raqm_allowed_grapheme_boundary (hb_codepoint_t l_char, - hb_codepoint_t r_char); - static void _raqm_init_text_info (raqm_t *rq) { @@ -517,10 +516,13 @@ raqm_clear_contents (raqm_t *rq) * @len: the length of @text. * * Adds @text to @rq to be used for layout. It must be a valid UTF-32 text, any - * invalid characters will be replaced with U+FFFD. The text should typically - * represent a full paragraph, since doing the layout of chunks of text + * invalid characters will be replaced with U+FFFD. The text must + * represent a single full paragraph, since doing the layout of chunks of text * separately can give improper output. * + * The text must be set before any of the functions that assign attributes to + * it, e.g. raqm_set_freetype_face(), raqm_set_language(), etc. + * * Return value: * `true` if no errors happened, `false` otherwise. * @@ -552,31 +554,65 @@ raqm_set_text (raqm_t *rq, return true; } +/* Ported from HarfBuzz’s hb_utf8_t::next(). */ static const char * _raqm_get_utf8_codepoint (const char *str, + const char *end, uint32_t *out_codepoint) { - if (0xf0 == (0xf8 & str[0])) - { - *out_codepoint = ((0x07 & str[0]) << 18) | ((0x3f & str[1]) << 12) | ((0x3f & str[2]) << 6) | (0x3f & str[3]); - str += 4; - } - else if (0xe0 == (0xf0 & str[0])) - { - *out_codepoint = ((0x0f & str[0]) << 12) | ((0x3f & str[1]) << 6) | (0x3f & str[2]); - str += 3; - } - else if (0xc0 == (0xe0 & str[0])) - { - *out_codepoint = ((0x1f & str[0]) << 6) | (0x3f & str[1]); - str += 2; - } - else + uint32_t c = (unsigned char) *str++; + + if (c > 0x7Fu) { - *out_codepoint = str[0]; - str += 1; + if (c >= 0xC2u && c <= 0xDFu) /* Two-byte */ + { + unsigned int t1; + if (str < end && (t1 = (unsigned char) str[0] - 0x80u) <= 0x3Fu) + { + c = ((c & 0x1Fu) << 6) | t1; + str += 1; + } + else + c = 0xFFFDu; + } + else if (c >= 0xE0u && c <= 0xEFu) /* Three-byte */ + { + unsigned int t1, t2; + if (end - str >= 2 && + (t1 = (unsigned char) str[0] - 0x80u) <= 0x3Fu && + (t2 = (unsigned char) str[1] - 0x80u) <= 0x3Fu) + { + c = ((c & 0x0Fu) << 12) | (t1 << 6) | t2; + if (c < 0x0800u || (c >= 0xD800u && c <= 0xDFFFu)) + c = 0xFFFDu; + else + str += 2; + } + else + c = 0xFFFDu; + } + else if (c >= 0xF0u && c <= 0xF4u) /* Four-byte */ + { + unsigned int t1, t2, t3; + if (end - str >= 3 && + (t1 = (unsigned char) str[0] - 0x80u) <= 0x3Fu && + (t2 = (unsigned char) str[1] - 0x80u) <= 0x3Fu && + (t3 = (unsigned char) str[2] - 0x80u) <= 0x3Fu) + { + c = ((c & 0x07u) << 18) | (t1 << 12) | (t2 << 6) | t3; + if (c < 0x10000u || c > 0x10FFFFu) + c = 0xFFFDu; + else + str += 3; + } + else + c = 0xFFFDu; + } + else + c = 0xFFFDu; } + *out_codepoint = c; return str; } @@ -586,10 +622,11 @@ _raqm_u8_to_u32 (const char *text, size_t len, uint32_t *unicode) size_t in_len = 0; uint32_t *out_utf32 = unicode; const char *in_utf8 = text; + const char *end = text + len; - while ((*in_utf8 != '\0') && (in_len < len)) + while ((in_len < len) && (*in_utf8 != '\0')) { - const char *out_utf8 = _raqm_get_utf8_codepoint (in_utf8, out_utf32); + const char *out_utf8 = _raqm_get_utf8_codepoint (in_utf8, end, out_utf32); in_len += out_utf8 - in_utf8; in_utf8 = out_utf8; ++out_utf32; @@ -598,31 +635,35 @@ _raqm_u8_to_u32 (const char *text, size_t len, uint32_t *unicode) return (out_utf32 - unicode); } +/* Ported from HarfBuzz’s hb_utf16_xe_t::next(). */ static const uint16_t * _raqm_get_utf16_codepoint (const uint16_t *str, + const uint16_t *end, uint32_t *out_codepoint) { - if (str[0] >= 0xD800 && str[0] <= 0xDBFF) + uint32_t c = *str++; + + if (c < 0xD800u || c > 0xDFFFu) { - if (str[1] >= 0xDC00 && str[1] <= 0xDFFF) - { - uint32_t X = ((str[0] & ((1 << 6) -1)) << 10) | (str[1] & ((1 << 10) -1)); - uint32_t W = (str[0] >> 6) & ((1 << 5) - 1); - *out_codepoint = (W+1) << 16 | X; - str += 2; - } - else - { - /* A single high surrogate, this is an error. */ - *out_codepoint = str[0]; - str += 1; - } + *out_codepoint = c; + return str; } - else + + if (c <= 0xDBFFu && str < end) { - *out_codepoint = str[0]; + /* High-surrogate in c */ + uint32_t l = *str; + if (l >= 0xDC00u && l <= 0xDFFFu) + { + /* Low-surrogate in l */ + *out_codepoint = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u); str += 1; + return str; + } } + + /* Lonely / out-of-order surrogate. */ + *out_codepoint = 0xFFFDu; return str; } @@ -632,10 +673,11 @@ _raqm_u16_to_u32 (const uint16_t *text, size_t len, uint32_t *unicode) size_t in_len = 0; uint32_t *out_utf32 = unicode; const uint16_t *in_utf16 = text; + const uint16_t *end = text + len; - while ((*in_utf16 != '\0') && (in_len < len)) + while ((in_len < len) && (*in_utf16 != '\0')) { - const uint16_t *out_utf16 = _raqm_get_utf16_codepoint (in_utf16, out_utf32); + const uint16_t *out_utf16 = _raqm_get_utf16_codepoint (in_utf16, end, out_utf32); in_len += (out_utf16 - in_utf16); in_utf16 = out_utf16; ++out_utf32; @@ -935,6 +977,9 @@ _raqm_set_freetype_face (raqm_t *rq, * * Sets an #FT_Face to be used for all characters in @rq. * + * The text must be set with raqm_set_text() or one of its variants before + * calling this function. + * * See also raqm_set_freetype_face_range(). * * Return value: @@ -1104,13 +1149,13 @@ _raqm_set_spacing (raqm_t *rq, { bool set_spacing = i == 0; if (!set_spacing) - set_spacing = _raqm_allowed_grapheme_boundary (rq->text[i-1], rq->text[i]); + set_spacing = raqm_allowed_grapheme_boundary (rq, i - 1); if (set_spacing) { if (word_spacing) { - if (_raqm_allowed_grapheme_boundary (rq->text[i], rq->text[i+1])) + if (raqm_allowed_grapheme_boundary (rq, i)) { /* CSS word separators, word spacing is only applied on these.*/ if (rq->text[i] == 0x0020 || /* Space */ @@ -1265,6 +1310,15 @@ _raqm_itemize (raqm_t *rq); static bool _raqm_shape (raqm_t *rq); +static bool +_raqm_is_paragraph_separator (uint32_t ch) +{ + /* Unicode characters with Bidi class B (Paragraph_Separator). */ + return ch == 0x000A || ch == 0x000D || + ch == 0x001C || ch == 0x001D || ch == 0x001E || + ch == 0x0085 || ch == 0x2029; +} + /** * raqm_layout: * @rq: a #raqm_t. @@ -1274,7 +1328,8 @@ _raqm_shape (raqm_t *rq); * text shaping, and any other part of the layout process. * * Return value: - * `true` if the layout process was successful, `false` otherwise. + * `true` if the layout process was successful, `false` otherwise. It also fails + * if the text is not a single paragraph (see raqm_set_text()). * * Since: 0.1 */ @@ -1294,6 +1349,10 @@ raqm_layout (raqm_t *rq) { if (!rq->text_info[i].ftface) return false; + + /* The text must be a single paragraph. */ + if (_raqm_is_paragraph_separator (rq->text[i])) + return false; } if (!_raqm_itemize (rq)) @@ -1439,6 +1498,37 @@ raqm_get_par_resolved_direction (raqm_t *rq) return rq->resolved_dir; } +static raqm_direction_t +_raqm_detect_direction (raqm_t *rq); + +/** + * raqm_get_par_detected_direction: + * @rq: a #raqm_t. + * + * Gets the natural direction of the text as detected from its content + * following the Unicode Bidirectional Algorithm, regardless of the base + * direction set with raqm_set_par_direction(). Unlike + * raqm_get_par_resolved_direction(), this does not require raqm_layout() to + * have been called, and can report that the text is direction neutral. + * + * Return value: + * #RAQM_DIRECTION_LTR or #RAQM_DIRECTION_RTL if the text has a strong + * direction, or #RAQM_DIRECTION_DEFAULT if the text is direction neutral (has + * no strong characters) or no text has been set. #RAQM_DIRECTION_TTB is never + * returned, as vertical direction is a layout property, not a property of the + * text content. + * + * Since: 0.11 + */ +raqm_direction_t +raqm_get_par_detected_direction (raqm_t *rq) +{ + if (!rq || !rq->text || rq->text_len == 0) + return RAQM_DIRECTION_DEFAULT; + + return _raqm_detect_direction (rq); +} + /** * raqm_get_direction_at_index: * @rq: a #raqm_t. @@ -1559,6 +1649,31 @@ _raqm_bidi_itemize (raqm_t *rq, size_t *run_count) return runs; } + +static raqm_direction_t +_raqm_detect_direction (raqm_t *rq) +{ + raqm_direction_t dir = RAQM_DIRECTION_DEFAULT; + size_t isolate = 0; + + /* UBA: P2 and P3. */ + for (size_t i = 0; i < rq->text_len; i++) + { + SBBidiType type = SBCodepointGetBidiType (rq->text[i]); + + if (type == SBBidiTypeLRI || type == SBBidiTypeRLI || type == SBBidiTypeFSI) + isolate++; + else if (type == SBBidiTypePDI && isolate > 0) + isolate--; + else if (isolate == 0 && SBBidiTypeIsStrong (type)) + { + dir = (type == SBBidiTypeL) ? RAQM_DIRECTION_LTR : RAQM_DIRECTION_RTL; + break; + } + } + + return dir; +} #else static void _raqm_reverse_run (_raqm_bidi_run *run, const size_t len) @@ -1712,6 +1827,30 @@ _raqm_bidi_itemize (raqm_t *rq, size_t *run_count) return runs; } + +static raqm_direction_t +_raqm_detect_direction (raqm_t *rq) +{ + raqm_direction_t dir = RAQM_DIRECTION_DEFAULT; + FriBidiParType par_type; + FriBidiCharType *types; + + types = calloc (rq->text_len, sizeof (FriBidiCharType)); + if (types) + { + fribidi_get_bidi_types (rq->text, rq->text_len, types); + par_type = fribidi_get_par_direction (types, rq->text_len); + + if (par_type == FRIBIDI_PAR_LTR) + dir = RAQM_DIRECTION_LTR; + else if (par_type == FRIBIDI_PAR_RTL) + dir = RAQM_DIRECTION_RTL; + + free (types); + } + + return dir; +} #endif static bool @@ -2365,9 +2504,6 @@ _raqm_encoding_to_u32_index (raqm_t *rq, return index; } -static bool -_raqm_in_hangul_syllable (hb_codepoint_t ch); - /** * raqm_index_to_position: * @rq: a #raqm_t. @@ -2406,7 +2542,7 @@ raqm_index_to_position (raqm_t *rq, while (*index < rq->text_len) { - if (_raqm_allowed_grapheme_boundary (rq->text[*index], rq->text[*index + 1])) + if (raqm_allowed_grapheme_boundary (rq, *index)) break; ++*index; @@ -2539,7 +2675,7 @@ raqm_position_to_index (raqm_t *rq, *index = next_cluster; } - if (_raqm_allowed_grapheme_boundary (rq->text[*index],rq->text[*index + 1])) + if (raqm_allowed_grapheme_boundary (rq, *index)) { RAQM_TEST ("The start-index is %zu at position %d \n", *index, x); return true; @@ -2547,8 +2683,7 @@ raqm_position_to_index (raqm_t *rq, while (*index < (unsigned)run->pos + run->len) { - if (_raqm_allowed_grapheme_boundary (rq->text[*index], - rq->text[*index + 1])) + if (raqm_allowed_grapheme_boundary (rq, *index)) { *index += 1; break; @@ -2574,137 +2709,140 @@ raqm_position_to_index (raqm_t *rq, return true; } -typedef enum +/** + * raqm_allowed_grapheme_boundary: + * @rq: a #raqm_t. + * @index: the index of the boundary to check. + * + * Checks whether a grapheme cluster boundary is allowed between the characters + * at @index and @index + 1, according to the Unicode Standard Annex #29 rules. + * + * The @rq must have had text set on it using raqm_set_text(). + * + * Returns: `true` if a boundary is allowed, `false` otherwise. + * + * Since: 0.11 + **/ +RAQM_API bool +raqm_allowed_grapheme_boundary (raqm_t *rq, + size_t index) { - RAQM_GRAPHEM_CR, - RAQM_GRAPHEM_LF, - RAQM_GRAPHEM_CONTROL, - RAQM_GRAPHEM_EXTEND, - RAQM_GRAPHEM_REGIONAL_INDICATOR, - RAQM_GRAPHEM_PREPEND, - RAQM_GRAPHEM_SPACING_MARK, - RAQM_GRAPHEM_HANGUL_SYLLABLE, - RAQM_GRAPHEM_OTHER -} _raqm_grapheme_t; + if (!rq) + return true; + + /* GB1/GB2: break at start and end of text */ + if (index >= rq->text_len - 1) + return true; -static _raqm_grapheme_t -_raqm_get_grapheme_break (hb_codepoint_t ch, - hb_unicode_general_category_t category); + uint32_t l_char = rq->text[index]; + uint32_t r_char = rq->text[index + 1]; + _raqm_grapheme_t l = _raqm_get_grapheme_break (l_char); + _raqm_grapheme_t r = _raqm_get_grapheme_break (r_char); -static bool -_raqm_allowed_grapheme_boundary (hb_codepoint_t l_char, - hb_codepoint_t r_char) -{ - hb_unicode_general_category_t l_category; - hb_unicode_general_category_t r_category; - _raqm_grapheme_t l_grapheme, r_grapheme; - hb_unicode_funcs_t* unicode_funcs = hb_unicode_funcs_get_default (); - - l_category = hb_unicode_general_category (unicode_funcs, l_char); - r_category = hb_unicode_general_category (unicode_funcs, r_char); - l_grapheme = _raqm_get_grapheme_break (l_char, l_category); - r_grapheme = _raqm_get_grapheme_break (r_char, r_category); - - if (l_grapheme == RAQM_GRAPHEM_CR && r_grapheme == RAQM_GRAPHEM_LF) - return false; /*Do not break between a CR and LF GB3*/ - if (l_grapheme == RAQM_GRAPHEM_CONTROL || l_grapheme == RAQM_GRAPHEM_CR || - l_grapheme == RAQM_GRAPHEM_LF || r_grapheme == RAQM_GRAPHEM_CONTROL || - r_grapheme == RAQM_GRAPHEM_CR || r_grapheme == RAQM_GRAPHEM_LF) - return true; /*Break before and after CONTROL GB4, GB5*/ - if (r_grapheme == RAQM_GRAPHEM_HANGUL_SYLLABLE) - return false; /*Do not break Hangul syllable sequences. GB6, GB7, GB8*/ - if (l_grapheme == RAQM_GRAPHEM_REGIONAL_INDICATOR && - r_grapheme == RAQM_GRAPHEM_REGIONAL_INDICATOR) - return false; /*Do not break between regional indicator symbols. GB8a*/ - if (r_grapheme == RAQM_GRAPHEM_EXTEND) - return false; /*Do not break before extending characters. GB9*/ - /*Do not break before SpacingMarks, or after Prepend characters.GB9a, GB9b*/ - if (l_grapheme == RAQM_GRAPHEM_PREPEND) - return false; - if (r_grapheme == RAQM_GRAPHEM_SPACING_MARK) + /* GB3: CR × LF */ + if (l == RAQM_GRAPHEME_CR && r == RAQM_GRAPHEME_LF) return false; - return true; /*Otherwise, break everywhere. GB1, GB2, GB10*/ -} -static _raqm_grapheme_t -_raqm_get_grapheme_break (hb_codepoint_t ch, - hb_unicode_general_category_t category) -{ - _raqm_grapheme_t gb_type; + /* GB4: (Control|CR|LF) ÷ */ + if (l == RAQM_GRAPHEME_CONTROL || l == RAQM_GRAPHEME_CR || + l == RAQM_GRAPHEME_LF) + return true; - gb_type = RAQM_GRAPHEM_OTHER; - switch ((int)category) - { - case HB_UNICODE_GENERAL_CATEGORY_FORMAT: - if (ch == 0x200C || ch == 0x200D) - gb_type = RAQM_GRAPHEM_EXTEND; - else - gb_type = RAQM_GRAPHEM_CONTROL; - break; + /* GB5: ÷ (Control|CR|LF) */ + if (r == RAQM_GRAPHEME_CONTROL || r == RAQM_GRAPHEME_CR || + r == RAQM_GRAPHEME_LF) + return true; - case HB_UNICODE_GENERAL_CATEGORY_CONTROL: - if (ch == 0x000D) - gb_type = RAQM_GRAPHEM_CR; - else if (ch == 0x000A) - gb_type = RAQM_GRAPHEM_LF; - else - gb_type = RAQM_GRAPHEM_CONTROL; - break; + /* GB6: L × (L|V|LV|LVT) */ + if (l == RAQM_GRAPHEME_L && + (r == RAQM_GRAPHEME_L || r == RAQM_GRAPHEME_V || + r == RAQM_GRAPHEME_LV || r == RAQM_GRAPHEME_LVT)) + return false; - case HB_UNICODE_GENERAL_CATEGORY_SURROGATE: - case HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR: - case HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR: - case HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED: - if ((ch >= 0xFFF0 && ch <= 0xFFF8) || - (ch >= 0xE0000 && ch <= 0xE0FFF)) - gb_type = RAQM_GRAPHEM_CONTROL; - break; + /* GB7: (LV|V) × (V|T) */ + if ((l == RAQM_GRAPHEME_LV || l == RAQM_GRAPHEME_V) && + (r == RAQM_GRAPHEME_V || r == RAQM_GRAPHEME_T)) + return false; - case HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK: - case HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK: - case HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK: - if (ch != 0x102B && ch != 0x102C && ch != 0x1038 && - (ch < 0x1062 || ch > 0x1064) && (ch < 0x1067 || ch > 0x106D) && - ch != 0x1083 && (ch < 0x1087 || ch > 0x108C) && ch != 0x108F && - (ch < 0x109A || ch > 0x109C) && ch != 0x1A61 && ch != 0x1A63 && - ch != 0x1A64 && ch != 0xAA7B && ch != 0xAA70 && ch != 0x11720 && - ch != 0x11721) /**/ - gb_type = RAQM_GRAPHEM_SPACING_MARK; - - else if (ch == 0x09BE || ch == 0x09D7 || - ch == 0x0B3E || ch == 0x0B57 || ch == 0x0BBE || ch == 0x0BD7 || - ch == 0x0CC2 || ch == 0x0CD5 || ch == 0x0CD6 || - ch == 0x0D3E || ch == 0x0D57 || ch == 0x0DCF || ch == 0x0DDF || - ch == 0x1D165 || (ch >= 0x1D16E && ch <= 0x1D172)) - gb_type = RAQM_GRAPHEM_EXTEND; - break; + /* GB8: (LVT|T) × T */ + if ((l == RAQM_GRAPHEME_LVT || l == RAQM_GRAPHEME_T) && + r == RAQM_GRAPHEME_T) + return false; - case HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER: - if (ch == 0x0E33 || ch == 0x0EB3) - gb_type = RAQM_GRAPHEM_SPACING_MARK; - break; + /* GB9: × (Extend|ZWJ) */ + if (r == RAQM_GRAPHEME_EXTEND || r == RAQM_GRAPHEME_ZWJ) + return false; - case HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL: - if (ch >= 0x1F1E6 && ch <= 0x1F1FF) - gb_type = RAQM_GRAPHEM_REGIONAL_INDICATOR; - break; + /* GB9a: × SpacingMark */ + if (r == RAQM_GRAPHEME_SPACING_MARK) + return false; - default: - gb_type = RAQM_GRAPHEM_OTHER; - break; + /* GB9b: Prepend × */ + if (l == RAQM_GRAPHEME_PREPEND) + return false; + + /* GB9c: \p{InCB=Consonant} [\p{InCB=Extend}\p{InCB=Linker}]* + * \p{InCB=Linker} [\p{InCB=Extend}\p{InCB=Linker}]* × \p{InCB=Consonant} + * + * If r_char is InCB=Consonant, look back for the required pattern. */ + if (_raqm_get_incb (r_char) == RAQM_INCB_CONSONANT) + { + bool found_linker = false; + size_t j = index + 1; + while (j > 0) + { + j--; + _raqm_incb_t incb = _raqm_get_incb (rq->text[j]); + if (incb == RAQM_INCB_LINKER) + found_linker = true; + else if (incb == RAQM_INCB_EXTEND) + ; /* Continue looking back through Extend characters */ + else if (incb == RAQM_INCB_CONSONANT) + { + if (found_linker) + return false; + break; + } + else + break; + } } - if (_raqm_in_hangul_syllable (ch)) - gb_type = RAQM_GRAPHEM_HANGUL_SYLLABLE; + /* GB11: ExtPict Extend* ZWJ × ExtPict */ + if (l == RAQM_GRAPHEME_ZWJ && + r == RAQM_GRAPHEME_EXTENDED_PICTOGRAPHIC) + { + /* Look back past the ZWJ at index for Extend* ExtPict */ + for (size_t j = index; j > 0; j--) + { + _raqm_grapheme_t g = _raqm_get_grapheme_break (rq->text[j - 1]); + if (g == RAQM_GRAPHEME_EXTEND) + continue; + if (g == RAQM_GRAPHEME_EXTENDED_PICTOGRAPHIC) + return false; + break; + } + } - return gb_type; -} + /* GB12/GB13: Do not break between regional indicator symbols if there is + * an odd number of RI characters before the break point. */ + if (l == RAQM_GRAPHEME_REGIONAL_INDICATOR && + r == RAQM_GRAPHEME_REGIONAL_INDICATOR) + { + size_t ri_count = 0; + for (size_t j = index + 1; j > 0; j--) + { + if (_raqm_get_grapheme_break (rq->text[j - 1]) != RAQM_GRAPHEME_REGIONAL_INDICATOR) + break; + ri_count++; + } + /* If odd number of RI before the break, don't break (they pair up) */ + if (ri_count % 2 == 1) + return false; + } -static bool -_raqm_in_hangul_syllable (hb_codepoint_t ch) -{ - (void)ch; - return false; + /* GB999: Otherwise, break everywhere. */ + return true; } /** diff --git a/src/thirdparty/raqm/raqm.h b/src/thirdparty/raqm/raqm.h index 4c75f9d46a1..4b60f148e01 100644 --- a/src/thirdparty/raqm/raqm.h +++ b/src/thirdparty/raqm/raqm.h @@ -183,6 +183,9 @@ raqm_get_glyphs (raqm_t *rq, RAQM_API raqm_direction_t raqm_get_par_resolved_direction (raqm_t *rq); +RAQM_API raqm_direction_t +raqm_get_par_detected_direction (raqm_t *rq); + RAQM_API raqm_direction_t raqm_get_direction_at_index (raqm_t *rq, size_t index); @@ -207,6 +210,10 @@ raqm_version (unsigned int *major, RAQM_API const char * raqm_version_string (void); +RAQM_API bool +raqm_allowed_grapheme_boundary (raqm_t *rq, + size_t index); + RAQM_API bool raqm_version_atleast (unsigned int major, unsigned int minor,