Revert "Add script and language to SkShaper::RunHandler"
This reverts commit 360fe72b5bf49b02969197088db1935efe644e48.
Reason for revert: Braking internal roll. Reland after fixing.
Original change's description:
> Add script and language to SkShaper::RunHandler
>
> This information is always immediately available and can be useful to
> the caller when reporting resolved locale information for accessibility
> or for making decisions in post-processing.
>
> Bug: 458132646
> Change-Id: Ie6a07a77fbc132f44b14bb1beb789ae64a55a95b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1094956
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
Bug: 458132646
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I652fc08788508730de267e937d41641c7ba79b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1095816
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
diff --git a/modules/skparagraph/src/OneLineShaper.cpp b/modules/skparagraph/src/OneLineShaper.cpp
index 8560f75..481a8e0 100644
--- a/modules/skparagraph/src/OneLineShaper.cpp
+++ b/modules/skparagraph/src/OneLineShaper.cpp
@@ -201,8 +201,6 @@
const SkShaper::RunHandler::RunInfo info = {
run->fFont,
run->fBidiLevel,
- run->fScript,
- run->fLanguage.c_str(),
runAdvance,
glyphs.width(),
SkShaper::RunHandler::Range(text.start - run->fClusterStart, text.width())
@@ -599,8 +597,6 @@
const SkShaper::RunHandler::RunInfo runInfo = {
font,
bidiLevel,
- 0,
- "",
SkPoint::Make(placeholder.fStyle.fWidth, placeholder.fStyle.fHeight),
1,
SkShaper::RunHandler::Range(0, placeholder.fRange.width())
diff --git a/modules/skparagraph/src/Run.cpp b/modules/skparagraph/src/Run.cpp
index 589f1e7..ebb7ebf 100644
--- a/modules/skparagraph/src/Run.cpp
+++ b/modules/skparagraph/src/Run.cpp
@@ -37,8 +37,6 @@
, fBaselineShift(baselineShift)
{
fBidiLevel = info.fBidiLevel;
- fScript = info.fScript;
- fLanguage = info.fLanguage;
fAdvance = info.fAdvance;
fIndex = index;
fUtf8Range = info.utf8Range;
diff --git a/modules/skparagraph/src/Run.h b/modules/skparagraph/src/Run.h
index 0edc58f..d1294d4 100644
--- a/modules/skparagraph/src/Run.h
+++ b/modules/skparagraph/src/Run.h
@@ -212,8 +212,6 @@
bool fEllipsis;
uint8_t fBidiLevel;
- SkFourByteTag fScript;
- SkString fLanguage;
};
template<typename Visitor>
diff --git a/modules/skshaper/include/SkShaper.h b/modules/skshaper/include/SkShaper.h
index 0538e2a..32d1c10 100644
--- a/modules/skshaper/include/SkShaper.h
+++ b/modules/skshaper/include/SkShaper.h
@@ -209,8 +209,6 @@
struct RunInfo {
const SkFont& fFont;
uint8_t fBidiLevel;
- SkFourByteTag fScript;
- const char* fLanguage;
SkVector fAdvance;
size_t glyphCount;
Range utf8Range;
diff --git a/modules/skshaper/src/SkShaper_coretext.cpp b/modules/skshaper/src/SkShaper_coretext.cpp
index e20ea0a..d730790 100644
--- a/modules/skshaper/src/SkShaper_coretext.cpp
+++ b/modules/skshaper/src/SkShaper_coretext.cpp
@@ -272,11 +272,9 @@
auto range = utf8IndicesMap.mapRange(cfRange.location, cfRange.length);
fontStorage.push_back(run_to_font(run, font));
- infos.push_back(SkShaper::RunHandler::RunInfo{
+ infos.push_back({
fontStorage.back(), // info just stores a ref to the font
- 0, // TODO: need fBidiLevel
- 0, // TODO: need fScript
- "", // TODO: need fLanguage
+ 0, // need fBidiLevel
{adv, 0},
(size_t)runGlyphs,
{range.first, range.second},
diff --git a/modules/skshaper/src/SkShaper_harfbuzz.cpp b/modules/skshaper/src/SkShaper_harfbuzz.cpp
index c3042bd..c40b01d 100644
--- a/modules/skshaper/src/SkShaper_harfbuzz.cpp
+++ b/modules/skshaper/src/SkShaper_harfbuzz.cpp
@@ -471,22 +471,15 @@
bool fUnsafeToBreak;
};
struct ShapedRun {
- ShapedRun(SkShaper::RunHandler::Range utf8Range,
- const SkFont& font,
- SkBidiIterator::Level level,
- SkFourByteTag script,
- const char* language,
- std::unique_ptr<ShapedGlyph[]> glyphs, size_t numGlyphs,
- SkVector advance = {0, 0})
- : fUtf8Range(utf8Range), fFont(font), fLevel(level), fScript(script), fLanguage(language)
+ ShapedRun(SkShaper::RunHandler::Range utf8Range, const SkFont& font, SkBidiIterator::Level level,
+ std::unique_ptr<ShapedGlyph[]> glyphs, size_t numGlyphs, SkVector advance = {0, 0})
+ : fUtf8Range(utf8Range), fFont(font), fLevel(level)
, fGlyphs(std::move(glyphs)), fNumGlyphs(numGlyphs), fAdvance(advance)
{}
SkShaper::RunHandler::Range fUtf8Range;
SkFont fFont;
SkBidiIterator::Level fLevel;
- SkFourByteTag fScript;
- const char* fLanguage;
std::unique_ptr<ShapedGlyph[]> fGlyphs;
size_t fNumGlyphs;
SkVector fAdvance;
@@ -556,8 +549,6 @@
const SkShaper::RunHandler::RunInfo info = {
run.fFont,
run.fLevel,
- run.fScript,
- run.fLanguage,
run.fAdvance,
run.fNumGlyphs,
run.fUtf8Range
@@ -572,8 +563,6 @@
const SkShaper::RunHandler::RunInfo info = {
run.fFont,
run.fLevel,
- run.fScript,
- run.fLanguage,
run.fAdvance,
run.fNumGlyphs,
run.fUtf8Range
@@ -833,7 +822,7 @@
utf8Start = utf8End;
utf8End = utf8 + runSegmenter.endOfCurrentRun();
- ShapedRun model(RunHandler::Range(), SkFont(), 0, 0, {}, nullptr, 0);
+ ShapedRun model(RunHandler::Range(), SkFont(), 0, nullptr, 0);
bool modelNeedsRegenerated = true;
int modelGlyphOffset = 0;
@@ -896,7 +885,7 @@
}
SkBreakIterator& breakIterator = *lineBreakIterator;
- ShapedRun best(RunHandler::Range(), SkFont(), 0, 0, {}, nullptr, 0,
+ ShapedRun best(RunHandler::Range(), SkFont(), 0, nullptr, 0,
{ SK_ScalarNegativeInfinity, SK_ScalarNegativeInfinity });
bool bestIsInvalid = true;
bool bestUsesModelForGlyphs = false;
@@ -915,7 +904,6 @@
candidateUsesModelForGlyphs = true;
return ShapedRun(RunHandler::Range(utf8Start - utf8, breakIteratorCurrent),
font.currentFont(), bidi.currentLevel(),
- script.currentScript(), language.currentLanguage(),
std::unique_ptr<ShapedGlyph[]>(),
props.glyphLen - modelGlyphOffset,
props.advance - modelAdvanceOffset);
@@ -1178,8 +1166,6 @@
return RunHandler::RunInfo{
sub.run.fFont,
sub.run.fLevel,
- sub.run.fScript,
- sub.run.fLanguage,
advance,
sub.endGlyphIndex - sub.startGlyphIndex,
RunHandler::Range(startUtf8, endUtf8 - startUtf8)
@@ -1233,8 +1219,6 @@
const RunHandler::RunInfo info = {
run.fFont,
run.fLevel,
- run.fScript,
- run.fLanguage,
run.fAdvance,
run.fNumGlyphs,
run.fUtf8Range
@@ -1246,8 +1230,6 @@
const RunHandler::RunInfo info = {
run.fFont,
run.fLevel,
- run.fScript,
- run.fLanguage,
run.fAdvance,
run.fNumGlyphs,
run.fUtf8Range
@@ -1303,9 +1285,7 @@
{
size_t utf8runLength = utf8End - utf8Start;
ShapedRun run(RunHandler::Range(utf8Start - utf8, utf8runLength),
- font.currentFont(), bidi.currentLevel(),
- script.currentScript(), language.currentLanguage(),
- nullptr, 0);
+ font.currentFont(), bidi.currentLevel(), nullptr, 0);
hb_buffer_t* buffer = fBuffer.get();
SkAutoTCallVProc<hb_buffer_t, hb_buffer_clear_contents> autoClearBuffer(buffer);
@@ -1398,7 +1378,6 @@
run = ShapedRun(RunHandler::Range(utf8Start - utf8, utf8runLength),
font.currentFont(), bidi.currentLevel(),
- script.currentScript(), language.currentLanguage(),
std::unique_ptr<ShapedGlyph[]>(new ShapedGlyph[len]), len);
// Undo skhb_position with (1.0/(1<<16)) and scale as needed.
diff --git a/modules/skshaper/src/SkShaper_primitive.cpp b/modules/skshaper/src/SkShaper_primitive.cpp
index cbd0c3a..e00e5d8 100644
--- a/modules/skshaper/src/SkShaper_primitive.cpp
+++ b/modules/skshaper/src/SkShaper_primitive.cpp
@@ -207,7 +207,8 @@
size_t numGlyphs = SkUTF::CountUTF8(utf8, bytesVisible);
const RunHandler::RunInfo info = {
- font, 0, 0, "",
+ font,
+ 0,
{ font.measureText(utf8, bytesVisible, SkTextEncoding::kUTF8), 0 },
numGlyphs,
RunHandler::Range(utf8Offset, bytesVisible)