Flutter Impeller
typeface_skia.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_TYPOGRAPHER_BACKENDS_SKIA_TYPEFACE_SKIA_H_
6 #define FLUTTER_IMPELLER_TYPOGRAPHER_BACKENDS_SKIA_TYPEFACE_SKIA_H_
7 
10 #include "third_party/skia/include/core/SkRefCnt.h"
11 #include "third_party/skia/include/core/SkTypeface.h"
12 
13 namespace impeller {
14 
15 class TypefaceSkia final : public Typeface,
16  public BackendCast<TypefaceSkia, Typeface> {
17  public:
18  explicit TypefaceSkia(sk_sp<SkTypeface> typeface);
19 
20  ~TypefaceSkia() override;
21 
22  // |Typeface|
23  bool IsValid() const override;
24 
25  // |Comparable<Typeface>|
26  std::size_t GetHash() const override;
27 
28  // |Comparable<Typeface>|
29  bool IsEqual(const Typeface& other) const override;
30 
31  const sk_sp<SkTypeface>& GetSkiaTypeface() const;
32 
33  private:
34  sk_sp<SkTypeface> typeface_;
35 
36  TypefaceSkia(const TypefaceSkia&) = delete;
37 
38  TypefaceSkia& operator=(const TypefaceSkia&) = delete;
39 };
40 
41 } // namespace impeller
42 
43 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_BACKENDS_SKIA_TYPEFACE_SKIA_H_
impeller::TypefaceSkia::IsEqual
bool IsEqual(const Typeface &other) const override
Definition: typeface_skia.cc:26
impeller::TypefaceSkia::GetHash
std::size_t GetHash() const override
Definition: typeface_skia.cc:18
impeller::TypefaceSkia::TypefaceSkia
TypefaceSkia(sk_sp< SkTypeface > typeface)
Definition: typeface_skia.cc:9
impeller::TypefaceSkia
Definition: typeface_skia.h:15
impeller::TypefaceSkia::GetSkiaTypeface
const sk_sp< SkTypeface > & GetSkiaTypeface() const
Definition: typeface_skia.cc:31
backend_cast.h
impeller::Typeface
A typeface, usually obtained from a font-file, on disk describes the intrinsic properties of the font...
Definition: typeface.h:18
typeface.h
impeller::BackendCast
Definition: backend_cast.h:11
impeller::TypefaceSkia::~TypefaceSkia
~TypefaceSkia() override
impeller::TypefaceSkia::IsValid
bool IsValid() const override
Definition: typeface_skia.cc:14
impeller
Definition: allocation.cc:12