[core] Replace GlyphRangeSet in onGlyphsAvailable with optionals in the map
GlyphRangeSet isn't keyed by FontStack, so using it to indicate that a particular range was loaded could have produced false positives.
This commit is contained in:
@@ -56,8 +56,8 @@ void justifyLine(std::vector<PositionedGlyph>& positionedGlyphs,
|
||||
|
||||
PositionedGlyph& glyph = positionedGlyphs[end];
|
||||
auto it = glyphs.find(glyph.glyph);
|
||||
if (it != glyphs.end()) {
|
||||
const uint32_t lastAdvance = it->second.metrics.advance;
|
||||
if (it != glyphs.end() && it->second) {
|
||||
const uint32_t lastAdvance = it->second->metrics.advance;
|
||||
const float lineIndent = float(glyph.x + lastAdvance) * justify;
|
||||
|
||||
for (std::size_t j = start; j <= end; j++) {
|
||||
@@ -74,8 +74,8 @@ float determineAverageLineWidth(const std::u16string& logicalInput,
|
||||
|
||||
for (char16_t chr : logicalInput) {
|
||||
auto it = glyphs.find(chr);
|
||||
if (it != glyphs.end()) {
|
||||
totalWidth += it->second.metrics.advance + spacing;
|
||||
if (it != glyphs.end() && it->second) {
|
||||
totalWidth += it->second->metrics.advance + spacing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,8 @@ std::set<std::size_t> determineLineBreaks(const std::u16string& logicalInput,
|
||||
for (std::size_t i = 0; i < logicalInput.size(); i++) {
|
||||
const char16_t codePoint = logicalInput[i];
|
||||
auto it = glyphs.find(codePoint);
|
||||
if (it != glyphs.end() && !boost::algorithm::is_any_of(u" \t\n\v\f\r")(codePoint)) {
|
||||
currentX += it->second.metrics.advance + spacing;
|
||||
if (it != glyphs.end() && it->second && !boost::algorithm::is_any_of(u" \t\n\v\f\r")(codePoint)) {
|
||||
currentX += it->second->metrics.advance + spacing;
|
||||
}
|
||||
|
||||
// Ideographic characters, spaces, and word-breaking punctuation that often appear without
|
||||
@@ -234,11 +234,11 @@ void shapeLines(Shaping& shaping,
|
||||
std::size_t lineStartIndex = shaping.positionedGlyphs.size();
|
||||
for (char16_t chr : line) {
|
||||
auto it = glyphs.find(chr);
|
||||
if (it == glyphs.end()) {
|
||||
if (it == glyphs.end() || !it->second) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Glyph& glyph = it->second;
|
||||
const Glyph& glyph = *it->second;
|
||||
|
||||
if (writingMode == WritingModeType::Horizontal || !util::i18n::hasUprightVerticalOrientation(chr)) {
|
||||
shaping.positionedGlyphs.emplace_back(chr, x, y, 0);
|
||||
|
||||
Reference in New Issue
Block a user