2015-07-29 17:14:58 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-03-20 16:08:46 +00:00
|
|
|
#ifndef RandomScalerContext_DEFINED
|
|
|
|
#define RandomScalerContext_DEFINED
|
2015-07-29 17:14:58 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkTypeface.h"
|
|
|
|
#include "src/core/SkScalerContext.h"
|
2015-07-29 17:14:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This scaler context is for debug only purposes. It will 'randomly' but deterministically return
|
|
|
|
* LCD / A8 / BW / RBGA masks based off of the Glyph ID
|
|
|
|
*/
|
|
|
|
|
|
|
|
class SkRandomTypeface : public SkTypeface {
|
|
|
|
public:
|
2016-05-12 17:09:30 +00:00
|
|
|
SkRandomTypeface(sk_sp<SkTypeface> proxy, const SkPaint&, bool fakeit);
|
2015-07-29 17:14:58 +00:00
|
|
|
|
2020-10-05 22:25:03 +00:00
|
|
|
SkTypeface* proxy() const { return fProxy.get(); }
|
2015-07-29 17:14:58 +00:00
|
|
|
const SkPaint& paint() const { return fPaint; }
|
|
|
|
|
|
|
|
protected:
|
2020-12-22 19:16:16 +00:00
|
|
|
std::unique_ptr<SkScalerContext> onCreateScalerContext(const SkScalerContextEffects&,
|
|
|
|
const SkDescriptor*) const override;
|
2020-10-05 22:25:03 +00:00
|
|
|
void onFilterRec(SkScalerContextRec*) const override;
|
|
|
|
void getGlyphToUnicodeMap(SkUnichar*) const override;
|
2017-05-04 18:23:55 +00:00
|
|
|
std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override;
|
2020-10-05 22:25:03 +00:00
|
|
|
std::unique_ptr<SkStreamAsset> onOpenStream(int* ttcIndex) const override;
|
2018-06-25 15:37:25 +00:00
|
|
|
sk_sp<SkTypeface> onMakeClone(const SkFontArguments& args) const override;
|
2020-10-05 22:25:03 +00:00
|
|
|
void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
|
2019-04-16 18:37:38 +00:00
|
|
|
void onCharsToGlyphs(const SkUnichar* chars, int count, SkGlyphID glyphs[]) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
int onCountGlyphs() const override;
|
|
|
|
int onGetUPEM() const override;
|
|
|
|
|
2020-10-05 22:25:03 +00:00
|
|
|
void onGetFamilyName(SkString* familyName) const override;
|
|
|
|
bool onGetPostScriptName(SkString*) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override;
|
|
|
|
|
2019-04-17 20:04:30 +00:00
|
|
|
void getPostScriptGlyphNames(SkString*) const override;
|
|
|
|
|
2017-02-24 16:15:26 +00:00
|
|
|
int onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[],
|
|
|
|
int coordinateCount) const override;
|
2018-06-26 15:22:37 +00:00
|
|
|
int onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],
|
|
|
|
int parameterCount) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
int onGetTableTags(SkFontTableTag tags[]) const override;
|
2019-03-20 16:08:46 +00:00
|
|
|
size_t onGetTableData(SkFontTableTag, size_t offset, size_t length, void* data) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
|
|
|
|
private:
|
2019-03-20 16:08:46 +00:00
|
|
|
sk_sp<SkTypeface> fProxy;
|
|
|
|
SkPaint fPaint;
|
|
|
|
bool fFakeIt;
|
2015-07-29 17:14:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|