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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkRandomScalerContext_DEFINED
|
|
|
|
#define SkRandomScalerContext_DEFINED
|
|
|
|
|
|
|
|
#include "SkScalerContext.h"
|
|
|
|
#include "SkTypeface.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
2016-05-12 17:09:30 +00:00
|
|
|
SkTypeface* proxy() const { return fProxy.get(); }
|
2015-07-29 17:14:58 +00:00
|
|
|
const SkPaint& paint() const { return fPaint; }
|
|
|
|
|
|
|
|
protected:
|
2016-04-12 13:47:05 +00:00
|
|
|
SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
|
|
|
|
const SkDescriptor*) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
void onFilterRec(SkScalerContextRec*) const override;
|
2018-05-09 15:50:34 +00:00
|
|
|
void getGlyphToUnicodeMap(SkUnichar*) const override;
|
2017-05-04 18:23:55 +00:00
|
|
|
std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
SkStreamAsset* onOpenStream(int* ttcIndex) const override;
|
2018-06-25 15:37:25 +00:00
|
|
|
sk_sp<SkTypeface> onMakeClone(const SkFontArguments& args) const override;
|
2015-07-29 17:14:58 +00:00
|
|
|
void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const override;
|
|
|
|
|
|
|
|
int onCharsToGlyphs(const void* chars, Encoding encoding,
|
|
|
|
uint16_t glyphs[], int glyphCount) const override;
|
|
|
|
int onCountGlyphs() const override;
|
|
|
|
int onGetUPEM() const override;
|
|
|
|
|
|
|
|
void onGetFamilyName(SkString* familyName) const override;
|
|
|
|
SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() 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;
|
|
|
|
size_t onGetTableData(SkFontTableTag, size_t offset,
|
|
|
|
size_t length, void* data) const override;
|
|
|
|
|
|
|
|
private:
|
2016-05-12 17:09:30 +00:00
|
|
|
sk_sp<SkTypeface> fProxy;
|
|
|
|
SkPaint fPaint;
|
|
|
|
bool fFakeIt;
|
2015-07-29 17:14:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|