Skip to content

Commit c1538ac

Browse files
authored
Update raqm to 0.10.3 (#9137)
2 parents 8b5e105 + 4f8ac76 commit c1538ac

File tree

5 files changed

+65
-43
lines changed

5 files changed

+65
-43
lines changed

depends/install_raqm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# install raqm
33

44

5-
archive=libraqm-0.10.2
5+
archive=libraqm-0.10.3
66

77
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz
88

src/thirdparty/raqm/COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright © 2015 Information Technology Authority (ITA) <[email protected]>
4-
Copyright © 2016-2023 Khaled Hosny <[email protected]>
4+
Copyright © 2016-2025 Khaled Hosny <[email protected]>
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

src/thirdparty/raqm/NEWS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
Overview of changes leading to 0.10.3
2+
Tuesday, August 5, 2025
3+
====================================
4+
5+
Fix raqm_set_text_utf8/utf16 reading beyond len for multibyte.
6+
7+
Support building against SheenBidi 2.9.
8+
9+
Fix deprecation warning with latest HarfBuzz.
10+
11+
Overview of changes leading to 0.10.2
12+
Sunday, September 22, 2024
13+
====================================
14+
15+
Fix Unicode codepoint conversion from UTF-16.
16+
117
Overview of changes leading to 0.10.1
218
Wednesday, April 12, 2023
319
====================================

src/thirdparty/raqm/raqm-version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333

3434
#define RAQM_VERSION_MAJOR 0
3535
#define RAQM_VERSION_MINOR 10
36-
#define RAQM_VERSION_MICRO 1
36+
#define RAQM_VERSION_MICRO 3
3737

38-
#define RAQM_VERSION_STRING "0.10.1"
38+
#define RAQM_VERSION_STRING "0.10.3"
3939

4040
#define RAQM_VERSION_ATLEAST(major,minor,micro) \
4141
((major)*10000+(minor)*100+(micro) <= \

src/thirdparty/raqm/raqm.c

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
#include <string.h>
3131

3232
#ifdef RAQM_SHEENBIDI
33+
#ifdef RAQM_SHEENBIDI_GT_2_9
34+
#include <SheenBidi/SheenBidi.h>
35+
#else
3336
#include <SheenBidi.h>
37+
#endif
3438
#else
3539
#ifdef HAVE_FRIBIDI_SYSTEM
3640
#include <fribidi.h>
@@ -546,34 +550,32 @@ raqm_set_text (raqm_t *rq,
546550
return true;
547551
}
548552

549-
static void *
550-
_raqm_get_utf8_codepoint (const void *str,
553+
static const char *
554+
_raqm_get_utf8_codepoint (const char *str,
551555
uint32_t *out_codepoint)
552556
{
553-
const char *s = (const char *)str;
554-
555-
if (0xf0 == (0xf8 & s[0]))
557+
if (0xf0 == (0xf8 & str[0]))
556558
{
557-
*out_codepoint = ((0x07 & s[0]) << 18) | ((0x3f & s[1]) << 12) | ((0x3f & s[2]) << 6) | (0x3f & s[3]);
558-
s += 4;
559+
*out_codepoint = ((0x07 & str[0]) << 18) | ((0x3f & str[1]) << 12) | ((0x3f & str[2]) << 6) | (0x3f & str[3]);
560+
str += 4;
559561
}
560-
else if (0xe0 == (0xf0 & s[0]))
562+
else if (0xe0 == (0xf0 & str[0]))
561563
{
562-
*out_codepoint = ((0x0f & s[0]) << 12) | ((0x3f & s[1]) << 6) | (0x3f & s[2]);
563-
s += 3;
564+
*out_codepoint = ((0x0f & str[0]) << 12) | ((0x3f & str[1]) << 6) | (0x3f & str[2]);
565+
str += 3;
564566
}
565-
else if (0xc0 == (0xe0 & s[0]))
567+
else if (0xc0 == (0xe0 & str[0]))
566568
{
567-
*out_codepoint = ((0x1f & s[0]) << 6) | (0x3f & s[1]);
568-
s += 2;
569+
*out_codepoint = ((0x1f & str[0]) << 6) | (0x3f & str[1]);
570+
str += 2;
569571
}
570572
else
571573
{
572-
*out_codepoint = s[0];
573-
s += 1;
574+
*out_codepoint = str[0];
575+
str += 1;
574576
}
575577

576-
return (void *)s;
578+
return str;
577579
}
578580

579581
static size_t
@@ -585,42 +587,41 @@ _raqm_u8_to_u32 (const char *text, size_t len, uint32_t *unicode)
585587

586588
while ((*in_utf8 != '\0') && (in_len < len))
587589
{
588-
in_utf8 = _raqm_get_utf8_codepoint (in_utf8, out_utf32);
590+
const char *out_utf8 = _raqm_get_utf8_codepoint (in_utf8, out_utf32);
591+
in_len += out_utf8 - in_utf8;
592+
in_utf8 = out_utf8;
589593
++out_utf32;
590-
++in_len;
591594
}
592595

593596
return (out_utf32 - unicode);
594597
}
595598

596-
static void *
597-
_raqm_get_utf16_codepoint (const void *str,
598-
uint32_t *out_codepoint)
599+
static const uint16_t *
600+
_raqm_get_utf16_codepoint (const uint16_t *str,
601+
uint32_t *out_codepoint)
599602
{
600-
const uint16_t *s = (const uint16_t *)str;
601-
602-
if (s[0] > 0xD800 && s[0] < 0xDBFF)
603+
if (str[0] >= 0xD800 && str[0] <= 0xDBFF)
603604
{
604-
if (s[1] > 0xDC00 && s[1] < 0xDFFF)
605+
if (str[1] >= 0xDC00 && str[1] <= 0xDFFF)
605606
{
606-
uint32_t X = ((s[0] & ((1 << 6) -1)) << 10) | (s[1] & ((1 << 10) -1));
607-
uint32_t W = (s[0] >> 6) & ((1 << 5) - 1);
607+
uint32_t X = ((str[0] & ((1 << 6) -1)) << 10) | (str[1] & ((1 << 10) -1));
608+
uint32_t W = (str[0] >> 6) & ((1 << 5) - 1);
608609
*out_codepoint = (W+1) << 16 | X;
609-
s += 2;
610+
str += 2;
610611
}
611612
else
612613
{
613614
/* A single high surrogate, this is an error. */
614-
*out_codepoint = s[0];
615-
s += 1;
615+
*out_codepoint = str[0];
616+
str += 1;
616617
}
617618
}
618619
else
619620
{
620-
*out_codepoint = s[0];
621-
s += 1;
621+
*out_codepoint = str[0];
622+
str += 1;
622623
}
623-
return (void *)s;
624+
return str;
624625
}
625626

626627
static size_t
@@ -632,9 +633,10 @@ _raqm_u16_to_u32 (const uint16_t *text, size_t len, uint32_t *unicode)
632633

633634
while ((*in_utf16 != '\0') && (in_len < len))
634635
{
635-
in_utf16 = _raqm_get_utf16_codepoint (in_utf16, out_utf32);
636+
const uint16_t *out_utf16 = _raqm_get_utf16_codepoint (in_utf16, out_utf32);
637+
in_len += (out_utf16 - in_utf16);
638+
in_utf16 = out_utf16;
636639
++out_utf32;
637-
++in_len;
638640
}
639641

640642
return (out_utf32 - unicode);
@@ -1114,12 +1116,12 @@ _raqm_set_spacing (raqm_t *rq,
11141116
{
11151117
if (_raqm_allowed_grapheme_boundary (rq->text[i], rq->text[i+1]))
11161118
{
1117-
/* CSS word seperators, word spacing is only applied on these.*/
1119+
/* CSS word separators, word spacing is only applied on these.*/
11181120
if (rq->text[i] == 0x0020 || /* Space */
11191121
rq->text[i] == 0x00A0 || /* No Break Space */
11201122
rq->text[i] == 0x1361 || /* Ethiopic Word Space */
1121-
rq->text[i] == 0x10100 || /* Aegean Word Seperator Line */
1122-
rq->text[i] == 0x10101 || /* Aegean Word Seperator Dot */
1123+
rq->text[i] == 0x10100 || /* Aegean Word Separator Line */
1124+
rq->text[i] == 0x10101 || /* Aegean Word Separator Dot */
11231125
rq->text[i] == 0x1039F || /* Ugaric Word Divider */
11241126
rq->text[i] == 0x1091F) /* Phoenician Word Separator */
11251127
{
@@ -2167,6 +2169,10 @@ _raqm_ft_transform (int *x,
21672169
*y = vector.y;
21682170
}
21692171

2172+
#if !HB_VERSION_ATLEAST (10, 4, 0)
2173+
# define hb_ft_font_get_ft_face hb_ft_font_get_face
2174+
#endif
2175+
21702176
static bool
21712177
_raqm_shape (raqm_t *rq)
21722178
{
@@ -2199,7 +2205,7 @@ _raqm_shape (raqm_t *rq)
21992205
hb_glyph_position_t *pos;
22002206
unsigned int len;
22012207

2202-
FT_Get_Transform (hb_ft_font_get_face (run->font), &matrix, NULL);
2208+
FT_Get_Transform (hb_ft_font_get_ft_face (run->font), &matrix, NULL);
22032209
pos = hb_buffer_get_glyph_positions (run->buffer, &len);
22042210
info = hb_buffer_get_glyph_infos (run->buffer, &len);
22052211

0 commit comments

Comments
 (0)