Skip to content

Commit c4b72d1

Browse files
committed
Ignore embedding level when collapsing a single line
1 parent 6f90ed6 commit c4b72d1

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# textshaping (development version)
22

3+
* Fixed a bug in bidi embedding arrangement when shaping a single line
4+
(ggplot2#6497)
5+
36
# textshaping 1.0.1
47

58
* Fixed a bug where hard line breaks where ignored if the line consisted of

src/string_shape.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,9 @@ EmbedInfo HarfBuzzShaper::shape_single_line(const char* string, FontSettings& fo
588588

589589
rearrange_embeddings(final_embeddings);
590590

591-
// Combined all embeddings into one
591+
// Combine all embeddings into one
592592
for (auto iter = std::next(final_embeddings.begin()); iter != final_embeddings.end(); ++iter) {
593-
final_embeddings.front().add(*iter);
593+
final_embeddings.front().add(*iter, false);
594594
}
595595
return final_embeddings.front();
596596
}

src/string_shape.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ struct EmbedInfo {
7979
size_t embedding_level;
8080
int32_t full_width;
8181
bool terminates_paragraph;
82-
void add(const EmbedInfo& other) {
83-
if (embedding_level != other.embedding_level) {
82+
void add(const EmbedInfo& other, bool check = true) {
83+
if (check && embedding_level != other.embedding_level) {
8484
cpp11::stop("Unable to merge embeddings of different levels");
8585
}
86-
if (terminates_paragraph) {
86+
if (check && terminates_paragraph) {
8787
cpp11::stop("Can't combine embeddings past termination point");
8888
}
8989
glyph_id.insert(glyph_id.end(), other.glyph_id.begin(), other.glyph_id.end());

0 commit comments

Comments
 (0)