Пример #1
0
 void Label::DetermineTokenWidths(Font* font, int outlineSize, const std::u16string& text, std::vector<double>& tokenWidths)
 {
     double tokenWidth = 0;
     double oneOverScale = 1.0 / font->GetFontScale();
     for(char16_t c : text)
     {
         Glyph* glyph = font->GetGlyph(c, outlineSize);
         if (c != ' ')
         {
             tokenWidth += outlineSize + std::max(glyph->GetSize().width, glyph->GetAdvance().x) * oneOverScale;
         }
         else
         {
             tokenWidths.push_back(tokenWidth);
             tokenWidth = 0;
         }
     }
     
     tokenWidths.push_back(tokenWidth);
 }