| 491 | } |
| 492 | |
| 493 | std::span<const int> UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() const |
| 494 | { |
| 495 | if (this->glyph_to_char.empty()) { |
| 496 | this->glyph_to_char.resize(this->GetGlyphCount()); |
| 497 | |
| 498 | /* The char to glyph array contains the first glyph index of the cluster that is associated |
| 499 | * with each character. It is possible for a cluster to be formed of several chars. */ |
| 500 | for (int c = 0; c < (int)this->char_to_glyph.size(); c++) { |
| 501 | /* If multiple chars map to one glyph, only refer back to the first character. */ |
| 502 | if (this->glyph_to_char[this->char_to_glyph[c]] == 0) this->glyph_to_char[this->char_to_glyph[c]] = c + this->start_pos; |
| 503 | } |
| 504 | |
| 505 | /* We only marked the first glyph of each cluster in the loop above. Fill the gaps. */ |
| 506 | int last_char = this->glyph_to_char[0]; |
| 507 | for (int g = 0; g < this->GetGlyphCount(); g++) { |
| 508 | if (this->glyph_to_char[g] != 0) last_char = this->glyph_to_char[g]; |
| 509 | this->glyph_to_char[g] = last_char; |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | return this->glyph_to_char; |
| 514 | } |
| 515 | |
| 516 | |
| 517 | /* virtual */ void UniscribeStringIterator::SetString(std::string_view s) |
no test coverage detected