height_override without a multiplier
Change-Id: I07b8631928de3e4920393124bac37fefbbaf4c2a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263568 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Julia Lavrova <jlavrova@google.com>
This commit is contained in:
parent
70a4fd2dfa
commit
f6a3f8eb74
@ -449,7 +449,7 @@ bool OneLineShaper::iterateThroughShapingRegions(const ShapeVisitor& shape) {
|
||||
auto& run = fParagraph->fRuns.emplace_back(this->fParagraph,
|
||||
runInfo,
|
||||
0,
|
||||
1.0f,
|
||||
0.0f,
|
||||
fParagraph->fRuns.count(),
|
||||
advanceX);
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
SkScalar ascent() const { return fFontMetrics.fAscent; }
|
||||
SkScalar correctAscent() const {
|
||||
|
||||
if (fHeightMultiplier == 0 || fHeightMultiplier == 1) {
|
||||
if (fHeightMultiplier == 0) {
|
||||
return fFontMetrics.fAscent - fFontMetrics.fLeading / 2;
|
||||
}
|
||||
return fFontMetrics.fAscent * fHeightMultiplier * fFont.getSize() /
|
||||
@ -86,7 +86,7 @@ public:
|
||||
}
|
||||
SkScalar correctDescent() const {
|
||||
|
||||
if (fHeightMultiplier == 0 || fHeightMultiplier == 1) {
|
||||
if (fHeightMultiplier == 0) {
|
||||
return fFontMetrics.fDescent + fFontMetrics.fLeading / 2;
|
||||
}
|
||||
return fFontMetrics.fDescent * fHeightMultiplier * fFont.getSize() /
|
||||
@ -94,7 +94,7 @@ public:
|
||||
}
|
||||
SkScalar correctLeading() const {
|
||||
|
||||
if (fHeightMultiplier == 0 || fHeightMultiplier == 1) {
|
||||
if (fHeightMultiplier == 0) {
|
||||
return fFontMetrics.fAscent;
|
||||
}
|
||||
return fFontMetrics.fLeading * fHeightMultiplier * fFont.getSize() /
|
||||
@ -128,7 +128,7 @@ public:
|
||||
void shift(const Cluster* cluster, SkScalar offset);
|
||||
|
||||
SkScalar calculateHeight() const {
|
||||
if (fHeightMultiplier == 0 || fHeightMultiplier == 1) {
|
||||
if (fHeightMultiplier == 0) {
|
||||
return fFontMetrics.fDescent - fFontMetrics.fAscent;
|
||||
}
|
||||
return fHeightMultiplier * fFont.getSize();
|
||||
|
@ -1701,21 +1701,21 @@ protected:
|
||||
void onDrawContent(SkCanvas* canvas) override {
|
||||
canvas->drawColor(SK_ColorWHITE);
|
||||
|
||||
auto fontCollection = sk_make_sp<TestFontCollection>(GetResourcePath("fonts").c_str(), false, true);
|
||||
|
||||
const char* text = "Pp PPp PPPp PPPPp PPPPpp PPPPppp PPPPppppp ";
|
||||
const char* text = "2,000 calories";
|
||||
ParagraphStyle paragraph_style;
|
||||
//paragraph_style.setEllipsis(u"\u2026");
|
||||
paragraph_style.setMaxLines(3);
|
||||
ParagraphBuilderImpl builder(paragraph_style, fontCollection);
|
||||
paragraph_style.setEllipsis(u"\u2026");
|
||||
paragraph_style.setMaxLines(std::numeric_limits<size_t>::max());
|
||||
ParagraphBuilderImpl builder(paragraph_style, getFontCollection());
|
||||
TextStyle text_style;
|
||||
text_style.setColor(SK_ColorBLACK);
|
||||
text_style.setFontFamilies({SkString("Ahem")});
|
||||
text_style.setFontSize(14);
|
||||
text_style.setFontFamilies({SkString("Google Sans")});
|
||||
text_style.setFontSize(24);
|
||||
text_style.setHeightOverride(true);
|
||||
text_style.setHeight(1.0f);
|
||||
builder.pushStyle(text_style);
|
||||
builder.addText(text);
|
||||
auto paragraph = builder.Build();
|
||||
paragraph->layout(100);
|
||||
paragraph->layout(155);
|
||||
paragraph->paint(canvas, 0, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user