Source/WebCore/ChangeLog

 12018-03-05 Myles C. Maxfield <mmaxfield@apple.com>
 2
 3 Change the type of SVGToOTFFontConverter::m_weight to be not a char
 4 https://bugs.webkit.org/show_bug.cgi?id=183339
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 No new tests because there is no behavior change.
 9
 10 * svg/SVGToOTFFontConversion.cpp:
 11 (WebCore::SVGToOTFFontConverter::appendOS2Table):
 12 (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
 13
1142018-03-05 Myles C. Maxfield <mmaxfield@apple.com>
215
316 [Cocoa] Allow user-installed fonts to be disabled

Source/WebCore/svg/SVGToOTFFontConversion.cpp

@@private:
264264 int m_descent;
265265 unsigned m_featureCountGSUB;
266266 unsigned m_tablesAppendedCount;
267  char m_weight;
 267 uint8_t m_weight;
268268 bool m_italic;
269269 bool m_error { false };
270270};

@@void SVGToOTFFontConverter::appendOS2Table()
499499
500500 append16(2); // Version
501501 append16(clampTo<int16_t>(averageAdvance));
502  append16(clampTo<uint16_t>(m_weight)); // Weight class
 502 append16(m_weight); // Weight class
503503 append16(5); // Width class
504504 append16(0); // Protected font
505505 // WebKit handles these superscripts and subscripts

@@void SVGToOTFFontConverter::appendOS2Table()
525525 for (auto& segment : segments) {
526526 bool ok;
527527 int value = segment.toInt(&ok);
528  if (ok && value >= 0 && value <= 0xFF)
 528 if (ok && value >= std::numeric_limits<uint8_t>::min() && value <= std::numeric_limits<uint8_t>::max())
529529 panoseBytes[numPanoseBytes++] = value;
530530 }
531531 }

@@SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement)
14611461 bool ok;
14621462 int value = segment.toInt(ok);
14631463 if (ok && value >= 0 && value < 1000) {
1464  m_weight = (value + 50) / 100;
 1464 m_weight = std::max(std::min((value + 50) / 100, static_cast<int>(std::numeric_limits<uint8_t>::max())), static_cast<int>(std::numeric_limits<uint8_t>::min()));
14651465 break;
14661466 }
14671467 }