Add font scale and skew in x to viewer.
Also change the names of some fields to remove the now redundant 'Text' specification to make things fit on lines. Change-Id: I4503eebaea406e82a1332dade0b6aea7dddf281f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202709 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
3e685ea164
commit
15a8d57175
@ -1122,9 +1122,15 @@ public:
|
||||
this->filterTextBlob(paint, blob, &cache), x, y, paint);
|
||||
}
|
||||
bool filterFont(SkTCopyOnFirstWrite<SkFont>* font) const {
|
||||
if (fFontOverrides->fTextSize) {
|
||||
if (fFontOverrides->fSize) {
|
||||
font->writable()->setSize(fFont->getSize());
|
||||
}
|
||||
if (fFontOverrides->fScaleX) {
|
||||
font->writable()->setScaleX(fFont->getScaleX());
|
||||
}
|
||||
if (fFontOverrides->fSkewX) {
|
||||
font->writable()->setSkewX(fFont->getSkewX());
|
||||
}
|
||||
if (fFontOverrides->fHinting) {
|
||||
font->writable()->setHinting(fFont->getHinting());
|
||||
}
|
||||
@ -1798,18 +1804,35 @@ void Viewer::drawImGui() {
|
||||
paramsChanged = true;
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Override TextSize", &fFontOverrides.fTextSize);
|
||||
if (fFontOverrides.fTextSize) {
|
||||
ImGui::DragFloat2("TextRange", fFontOverrides.fTextSizeRange,
|
||||
ImGui::Checkbox("Override Size", &fFontOverrides.fSize);
|
||||
if (fFontOverrides.fSize) {
|
||||
ImGui::DragFloat2("TextRange", fFontOverrides.fSizeRange,
|
||||
0.001f, -10.0f, 300.0f, "%.6f", 2.0f);
|
||||
float textSize = fFont.getSize();
|
||||
if (ImGui::DragFloat("TextSize", &textSize, 0.001f,
|
||||
fFontOverrides.fTextSizeRange[0],
|
||||
fFontOverrides.fTextSizeRange[1],
|
||||
fFontOverrides.fSizeRange[0],
|
||||
fFontOverrides.fSizeRange[1],
|
||||
"%.6f", 2.0f))
|
||||
{
|
||||
fFont.setSize(textSize);
|
||||
this->preTouchMatrixChanged();
|
||||
paramsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Override ScaleX", &fFontOverrides.fScaleX);
|
||||
if (fFontOverrides.fScaleX) {
|
||||
float scaleX = fFont.getScaleX();
|
||||
if (ImGui::SliderFloat("ScaleX", &scaleX, MIN_ZOOM_LEVEL, MAX_ZOOM_LEVEL)) {
|
||||
fFont.setScaleX(scaleX);
|
||||
paramsChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Override SkewX", &fFontOverrides.fSkewX);
|
||||
if (fFontOverrides.fSkewX) {
|
||||
float skewX = fFont.getSkewX();
|
||||
if (ImGui::SliderFloat("SkewX", &skewX, MIN_ZOOM_LEVEL, MAX_ZOOM_LEVEL)) {
|
||||
fFont.setSkewX(skewX);
|
||||
paramsChanged = true;
|
||||
}
|
||||
}
|
||||
|
@ -41,10 +41,10 @@ public:
|
||||
|
||||
struct SkFontFields {
|
||||
bool fTypeface = false;
|
||||
bool fTextSize = false;
|
||||
SkScalar fTextSizeRange[2] = { 0, 20 };
|
||||
bool fTextScaleX = false;
|
||||
bool fTextSkewX = false;
|
||||
bool fSize = false;
|
||||
SkScalar fSizeRange[2] = { 0, 20 };
|
||||
bool fScaleX = false;
|
||||
bool fSkewX = false;
|
||||
bool fHinting = false;
|
||||
bool fEdging = false;
|
||||
bool fSubpixel = false;
|
||||
|
Loading…
Reference in New Issue
Block a user