chromium-harfbuzz-2.0.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
  2. +++ a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
  3. @@ -139,7 +139,7 @@ static hb_position_t HarfBuzzGetGlyphHorizontalAdvance(hb_font_t* hb_font,
  4. static void HarfBuzzGetGlyphHorizontalAdvances(hb_font_t* font,
  5. void* font_data,
  6. unsigned count,
  7. - hb_codepoint_t* first_glyph,
  8. + const hb_codepoint_t* first_glyph,
  9. unsigned int glyph_stride,
  10. hb_position_t* first_advance,
  11. unsigned int advance_stride,
  12. --- a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.cc
  13. +++ a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.cc
  14. @@ -18,6 +18,11 @@ T* advance_by_byte_size(T* p, unsigned byte_size) {
  15. return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(p) + byte_size);
  16. }
  17. +template <class T>
  18. +T* advance_by_byte_size_const(T* p, unsigned byte_size) {
  19. + return reinterpret_cast<T*>(reinterpret_cast<const uint8_t*>(p) + byte_size);
  20. +}
  21. +
  22. } // namespace
  23. SkiaTextMetrics::SkiaTextMetrics(const SkPaint* paint) : paint_(paint) {
  24. @@ -39,7 +44,7 @@ void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(hb_codepoint_t codepoint,
  25. }
  26. void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count,
  27. - hb_codepoint_t* glyphs,
  28. + const hb_codepoint_t* glyphs,
  29. unsigned glyph_stride,
  30. hb_position_t* advances,
  31. unsigned advance_stride) {
  32. @@ -48,7 +53,7 @@ void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count,
  33. // array that copy them to a regular array.
  34. Vector<Glyph, 256> glyph_array(count);
  35. for (unsigned i = 0; i < count;
  36. - i++, glyphs = advance_by_byte_size(glyphs, glyph_stride)) {
  37. + i++, glyphs = advance_by_byte_size_const(glyphs, glyph_stride)) {
  38. glyph_array[i] = *glyphs;
  39. }
  40. Vector<SkScalar, 256> sk_width_array(count);
  41. --- a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h
  42. +++ a/third_party/blink/renderer/platform/fonts/skia/skia_text_metrics.h
  43. @@ -19,7 +19,7 @@ class SkiaTextMetrics final {
  44. void GetGlyphWidthForHarfBuzz(hb_codepoint_t, hb_position_t* width);
  45. void GetGlyphWidthForHarfBuzz(unsigned count,
  46. - hb_codepoint_t* first_glyph,
  47. + const hb_codepoint_t* first_glyph,
  48. unsigned glyph_stride,
  49. hb_position_t* first_advance,
  50. unsigned advance_stride);
  51. --