Skip to content

Commit

Permalink
Revert "Making fontStyle and fixedPitch fields "virtual""
Browse files Browse the repository at this point in the history
This reverts commit d1e1390.

Reason for revert: Breaking the tree

Original change's description:
> Making fontStyle and fixedPitch fields "virtual"
>
> Change-Id: Ia8483ec76d887bdf384db4a534e9f0ec1effa49c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/923296
> Reviewed-by: Ben Wagner <[email protected]>
> Commit-Queue: Julia Lavrova <[email protected]>

Change-Id: I7517aea65e28c428527f2418ce0dd791e942c1f2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/923396
Bot-Commit: Rubber Stamper <[email protected]>
Auto-Submit: Julia Lavrova <[email protected]>
Reviewed-by: Ben Wagner <[email protected]>
Commit-Queue: Ben Wagner <[email protected]>
  • Loading branch information
Rusino authored and SkCQ committed Nov 21, 2024
1 parent d1e1390 commit e4528e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 42 deletions.
14 changes: 6 additions & 8 deletions include/core/SkTypeface.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,20 @@ typedef uint32_t SkFontTableTag;
class SK_API SkTypeface : public SkWeakRefCnt {
public:
/** Returns the typeface's intrinsic style attributes. */
SkFontStyle fontStyle() const;
SkFontStyle fontStyle() const {
return fStyle;
}

/** Returns true if style() has the kBold bit set. */
bool isBold() const;
bool isBold() const { return fStyle.weight() >= SkFontStyle::kSemiBold_Weight; }

/** Returns true if style() has the kItalic bit set. */
bool isItalic() const;
bool isItalic() const { return fStyle.slant() != SkFontStyle::kUpright_Slant; }

/** Returns true if the typeface claims to be fixed-pitch.
* This is a style bit, advance widths may vary even if this returns true.
*/
bool isFixedPitch() const;
bool isFixedPitch() const { return fIsFixedPitch; }

/** Copy into 'coordinates' (allocated by the caller) the design variation coordinates.
*
Expand Down Expand Up @@ -361,10 +363,6 @@ class SK_API SkTypeface : public SkWeakRefCnt {
/** Sets the font style. If used, must be called in the constructor. */
void setFontStyle(SkFontStyle style) { fStyle = style; }

virtual SkFontStyle onGetFontStyle() const; // TODO: = 0;

virtual bool onGetFixedPitch() const; // TODO: = 0;

// Must return a valid scaler context. It can not return nullptr.
virtual std::unique_ptr<SkScalerContext> onCreateScalerContext(const SkScalerContextEffects&,
const SkDescriptor*) const = 0;
Expand Down
24 changes: 0 additions & 24 deletions src/core/SkTypeface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,30 +480,6 @@ int SkTypeface::onGetResourceName(SkString* resourceName) const {
return 0;
}

SkFontStyle SkTypeface::fontStyle() const {
return this->onGetFontStyle();
}

SkFontStyle SkTypeface::onGetFontStyle() const {
return fStyle;
}

bool SkTypeface::isBold() const {
return this->onGetFontStyle().weight() >= SkFontStyle::kSemiBold_Weight;
}

bool SkTypeface::isItalic() const {
return this->onGetFontStyle().slant() != SkFontStyle::kUpright_Slant;
}

bool SkTypeface::isFixedPitch() const {
return this->onGetFixedPitch();
}

bool SkTypeface::onGetFixedPitch() const {
return fIsFixedPitch;
}

void SkTypeface::getGlyphToUnicodeMap(SkUnichar* dst) const {
sk_bzero(dst, sizeof(SkUnichar) * this->countGlyphs());
}
Expand Down
8 changes: 0 additions & 8 deletions src/ports/SkTypeface_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ int SkTypeface_proxy::onGetVariationDesignParameters(SkFontParameters::Variation
return fProxy->onGetVariationDesignParameters(parameters, parameterCount);
}

SkFontStyle SkTypeface_proxy::onGetFontStyle() const {
return fProxy->onGetFontStyle();
}

bool SkTypeface_proxy::onGetFixedPitch() const {
return fProxy->onGetFixedPitch();
}

void SkTypeface_proxy::onGetFamilyName(SkString* familyName) const {
fProxy->onGetFamilyName(familyName);
}
Expand Down
2 changes: 0 additions & 2 deletions src/ports/SkTypeface_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class SkTypeface_proxy : public SkTypeface {
int coordinateCount) const override;
int onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],
int parameterCount) const override;
SkFontStyle onGetFontStyle() const override;
bool onGetFixedPitch() const override;
void onGetFamilyName(SkString* familyName) const override;
bool onGetPostScriptName(SkString* postScriptName) const override;
int onGetResourceName(SkString* resourceName) const override;
Expand Down

0 comments on commit e4528e2

Please sign in to comment.