Remove lang parameter from TextBlob alloc methods.
The 'lang' was never stored or used, so this makes no current practical difference. The original intent was to be able to specify a language so that it could be emitted as a 'Lang' override in the 'ActualText' when generating a PDF. However, due to the way 'ActualText' is generally used this would be impractical. If there is ever a desire to mark up sections of the PDF with a specific language it would be better handled in a different way. Change-Id: Id63596190235fc45ce17249b9b578b6f9b838b2b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375060 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
80313c85e0
commit
0baacb50bc
@ -381,21 +381,13 @@ public:
|
||||
const RunBuffer& allocRunRSXform(const SkFont& font, int count);
|
||||
|
||||
private:
|
||||
const RunBuffer& allocRunText(const SkFont& font,
|
||||
int count,
|
||||
SkScalar x,
|
||||
SkScalar y,
|
||||
int textByteCount,
|
||||
SkString lang,
|
||||
const SkRect* bounds = nullptr);
|
||||
const RunBuffer& allocRunTextPosH(const SkFont& font, int count, SkScalar y,
|
||||
int textByteCount, SkString lang,
|
||||
const RunBuffer& allocRunText(const SkFont& font, int count, SkScalar x, SkScalar y,
|
||||
int textByteCount, const SkRect* bounds = nullptr);
|
||||
const RunBuffer& allocRunTextPosH(const SkFont& font, int count, SkScalar y, int textByteCount,
|
||||
const SkRect* bounds = nullptr);
|
||||
const RunBuffer& allocRunTextPos(const SkFont& font, int count,
|
||||
int textByteCount, SkString lang,
|
||||
const RunBuffer& allocRunTextPos(const SkFont& font, int count, int textByteCount,
|
||||
const SkRect* bounds = nullptr);
|
||||
const RunBuffer& allocRunRSXform(const SkFont& font, int count,
|
||||
int textByteCount, SkString lang,
|
||||
const RunBuffer& allocRunRSXform(const SkFont& font, int count, int textByteCount,
|
||||
const SkRect* bounds = nullptr);
|
||||
|
||||
void reserve(size_t size);
|
||||
|
@ -114,7 +114,7 @@ SkShaper::RunHandler::Buffer RunHandler::runBuffer(const RunInfo& info) {
|
||||
int utf8RangeSize = SkTFitsIn<int>(info.utf8Range.size()) ? info.utf8Range.size() : INT_MAX;
|
||||
|
||||
const auto& runBuffer = SkTextBlobBuilderPriv::AllocRunTextPos(&fBuilder, info.fFont, glyphCount,
|
||||
utf8RangeSize, SkString());
|
||||
utf8RangeSize);
|
||||
fCurrentGlyphs = runBuffer.glyphs;
|
||||
fCurrentPoints = runBuffer.points();
|
||||
|
||||
|
@ -226,7 +226,7 @@ SkShaper::RunHandler::Buffer SkTextBlobBuilderRunHandler::runBuffer(const RunInf
|
||||
int utf8RangeSize = SkTFitsIn<int>(info.utf8Range.size()) ? info.utf8Range.size() : INT_MAX;
|
||||
|
||||
const auto& runBuffer = SkTextBlobBuilderPriv::AllocRunTextPos(&fBuilder, info.fFont, glyphCount,
|
||||
utf8RangeSize, SkString());
|
||||
utf8RangeSize);
|
||||
if (runBuffer.utf8text && fUtf8Text) {
|
||||
memcpy(runBuffer.utf8text, fUtf8Text + info.utf8Range.begin(), utf8RangeSize);
|
||||
}
|
||||
|
@ -553,7 +553,6 @@ SkTextBlobBuilder::allocRunRSXform(const SkFont& font, int count) {
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunText(const SkFont& font, int count,
|
||||
SkScalar x, SkScalar y,
|
||||
int textByteCount,
|
||||
SkString lang,
|
||||
const SkRect* bounds) {
|
||||
this->allocInternal(font,
|
||||
SkTextBlob::kDefault_Positioning,
|
||||
@ -564,10 +563,10 @@ const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunText(const SkFont
|
||||
return fCurrentRunBuffer;
|
||||
}
|
||||
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunTextPosH(const SkFont& font, int count,
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunTextPosH(const SkFont& font,
|
||||
int count,
|
||||
SkScalar y,
|
||||
int textByteCount,
|
||||
SkString lang,
|
||||
const SkRect* bounds) {
|
||||
this->allocInternal(font,
|
||||
SkTextBlob::kHorizontal_Positioning,
|
||||
@ -578,9 +577,9 @@ const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunTextPosH(const Sk
|
||||
return fCurrentRunBuffer;
|
||||
}
|
||||
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunTextPos(const SkFont& font, int count,
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunTextPos(const SkFont& font,
|
||||
int count,
|
||||
int textByteCount,
|
||||
SkString lang,
|
||||
const SkRect *bounds) {
|
||||
this->allocInternal(font,
|
||||
SkTextBlob::kFull_Positioning,
|
||||
@ -590,9 +589,9 @@ const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunTextPos(const SkF
|
||||
return fCurrentRunBuffer;
|
||||
}
|
||||
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunRSXform(const SkFont& font, int count,
|
||||
const SkTextBlobBuilder::RunBuffer& SkTextBlobBuilder::allocRunRSXform(const SkFont& font,
|
||||
int count,
|
||||
int textByteCount,
|
||||
SkString lang,
|
||||
const SkRect* bounds) {
|
||||
this->allocInternal(font,
|
||||
SkTextBlob::kRSXform_Positioning,
|
||||
@ -738,17 +737,17 @@ sk_sp<SkTextBlob> SkTextBlobPriv::MakeFromBuffer(SkReadBuffer& reader) {
|
||||
switch (pos) {
|
||||
case SkTextBlob::kDefault_Positioning:
|
||||
buf = &blobBuilder.allocRunText(font, glyphCount, offset.x(), offset.y(),
|
||||
textSize, SkString(), &bounds);
|
||||
textSize, &bounds);
|
||||
break;
|
||||
case SkTextBlob::kHorizontal_Positioning:
|
||||
buf = &blobBuilder.allocRunTextPosH(font, glyphCount, offset.y(),
|
||||
textSize, SkString(), &bounds);
|
||||
textSize, &bounds);
|
||||
break;
|
||||
case SkTextBlob::kFull_Positioning:
|
||||
buf = &blobBuilder.allocRunTextPos(font, glyphCount, textSize, SkString(), &bounds);
|
||||
buf = &blobBuilder.allocRunTextPos(font, glyphCount, textSize, &bounds);
|
||||
break;
|
||||
case SkTextBlob::kRSXform_Positioning:
|
||||
buf = &blobBuilder.allocRunRSXform(font, glyphCount, textSize, SkString(), &bounds);
|
||||
buf = &blobBuilder.allocRunRSXform(font, glyphCount, textSize, &bounds);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -43,23 +43,23 @@ class SkTextBlobBuilderPriv {
|
||||
public:
|
||||
static const SkTextBlobBuilder::RunBuffer& AllocRunText(SkTextBlobBuilder* builder,
|
||||
const SkFont& font, int count, SkScalar x, SkScalar y, int textByteCount,
|
||||
SkString lang, const SkRect* bounds = nullptr) {
|
||||
return builder->allocRunText(font, count, x, y, textByteCount, lang, bounds);
|
||||
const SkRect* bounds = nullptr) {
|
||||
return builder->allocRunText(font, count, x, y, textByteCount, bounds);
|
||||
}
|
||||
static const SkTextBlobBuilder::RunBuffer& AllocRunTextPosH(SkTextBlobBuilder* builder,
|
||||
const SkFont& font, int count, SkScalar y, int textByteCount, SkString lang,
|
||||
const SkFont& font, int count, SkScalar y, int textByteCount,
|
||||
const SkRect* bounds = nullptr) {
|
||||
return builder->allocRunTextPosH(font, count, y, textByteCount, lang, bounds);
|
||||
return builder->allocRunTextPosH(font, count, y, textByteCount, bounds);
|
||||
}
|
||||
static const SkTextBlobBuilder::RunBuffer& AllocRunTextPos(SkTextBlobBuilder* builder,
|
||||
const SkFont& font, int count, int textByteCount, SkString lang,
|
||||
const SkFont& font, int count, int textByteCount,
|
||||
const SkRect* bounds = nullptr) {
|
||||
return builder->allocRunTextPos(font, count, textByteCount, lang, bounds);
|
||||
return builder->allocRunTextPos(font, count, textByteCount, bounds);
|
||||
}
|
||||
static const SkTextBlobBuilder::RunBuffer& AllocRunRSXForm(SkTextBlobBuilder* builder,
|
||||
const SkFont& font, int count, int textByteCount, SkString lang,
|
||||
const SkFont& font, int count, int textByteCount,
|
||||
const SkRect* bounds = nullptr) {
|
||||
return builder->allocRunRSXform(font, count, textByteCount, lang, bounds);
|
||||
return builder->allocRunRSXform(font, count, textByteCount, bounds);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -324,7 +324,7 @@ DEF_TEST(TextBlob_extended, reporter) {
|
||||
(void)font.textToGlyphs(text1, strlen(text1), SkTextEncoding::kUTF8, glyphs.get(), glyphCount);
|
||||
|
||||
auto run = SkTextBlobBuilderPriv::AllocRunText(&textBlobBuilder,
|
||||
font, glyphCount, 0, 0, SkToInt(strlen(text2)), SkString(), nullptr);
|
||||
font, glyphCount, 0, 0, SkToInt(strlen(text2)), nullptr);
|
||||
memcpy(run.glyphs, glyphs.get(), sizeof(uint16_t) * glyphCount);
|
||||
memcpy(run.utf8text, text2, strlen(text2));
|
||||
for (int i = 0; i < glyphCount; ++i) {
|
||||
|
@ -1279,16 +1279,16 @@ public:
|
||||
const SkTextBlobBuilder::RunBuffer& runBuffer
|
||||
= it.positioning() == SkTextBlobRunIterator::kDefault_Positioning
|
||||
? SkTextBlobBuilderPriv::AllocRunText(&builder, font,
|
||||
it.glyphCount(), it.offset().x(),it.offset().y(), it.textSize(), SkString())
|
||||
it.glyphCount(), it.offset().x(),it.offset().y(), it.textSize())
|
||||
: it.positioning() == SkTextBlobRunIterator::kHorizontal_Positioning
|
||||
? SkTextBlobBuilderPriv::AllocRunTextPosH(&builder, font,
|
||||
it.glyphCount(), it.offset().y(), it.textSize(), SkString())
|
||||
it.glyphCount(), it.offset().y(), it.textSize())
|
||||
: it.positioning() == SkTextBlobRunIterator::kFull_Positioning
|
||||
? SkTextBlobBuilderPriv::AllocRunTextPos(&builder, font,
|
||||
it.glyphCount(), it.textSize(), SkString())
|
||||
it.glyphCount(), it.textSize())
|
||||
: it.positioning() == SkTextBlobRunIterator::kRSXform_Positioning
|
||||
? SkTextBlobBuilderPriv::AllocRunRSXForm(&builder, font,
|
||||
it.glyphCount(), it.textSize(), SkString())
|
||||
it.glyphCount(), it.textSize())
|
||||
: (SkASSERT_RELEASE(false), SkTextBlobBuilder::RunBuffer());
|
||||
uint32_t glyphCount = it.glyphCount();
|
||||
if (it.glyphs()) {
|
||||
|
Loading…
Reference in New Issue
Block a user