Codechange: Use structured bindings when iterating font_mapping.
This commit is contained in:
committed by
Peter Nelson
parent
c78e309b16
commit
59680867c3
@@ -283,8 +283,8 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
if (length == 0) return nullptr;
|
||||
|
||||
/* Can't layout our in-built sprite fonts. */
|
||||
for (auto const &pair : font_mapping) {
|
||||
if (pair.second->fc->IsBuiltInFont()) return nullptr;
|
||||
for (auto const &[position, font] : font_mapping) {
|
||||
if (font->fc->IsBuiltInFont()) return nullptr;
|
||||
}
|
||||
|
||||
/* Itemize text. */
|
||||
@@ -297,12 +297,12 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
|
||||
int cur_pos = 0;
|
||||
std::vector<SCRIPT_ITEM>::iterator cur_item = items.begin();
|
||||
for (auto const &i : font_mapping) {
|
||||
while (cur_pos < i.first && cur_item != items.end() - 1) {
|
||||
for (auto const &[position, font] : font_mapping) {
|
||||
while (cur_pos < position && cur_item != items.end() - 1) {
|
||||
/* Add a range that spans the intersection of the remaining item and font run. */
|
||||
int stop_pos = std::min(i.first, (cur_item + 1)->iCharPos);
|
||||
int stop_pos = std::min(position, (cur_item + 1)->iCharPos);
|
||||
assert(stop_pos - cur_pos > 0);
|
||||
ranges.emplace_back(cur_pos, stop_pos - cur_pos, i.second, cur_item->a);
|
||||
ranges.emplace_back(cur_pos, stop_pos - cur_pos, font, cur_item->a);
|
||||
|
||||
/* Shape the range. */
|
||||
if (!UniscribeShapeRun(buff, ranges.back())) {
|
||||
|
||||
Reference in New Issue
Block a user