• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright 2024 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 
8 #ifndef SKFONTSCANNER_H_
9 #define SKFONTSCANNER_H_
10 
11 #include "include/core/SkFontArguments.h"
12 #include "include/core/SkTypes.h"
13 #include "include/private/base/SkFixed.h"
14 #include "include/private/base/SkNoncopyable.h"
15 #include "include/private/base/SkTArray.h"
16 class SkFontStyle;
17 class SkStreamAsset;
18 class SkString;
19 
20 class SkFontScanner : public SkNoncopyable {
21 public:
22     virtual ~SkFontScanner() = default;
23     struct AxisDefinition {
24         SkFourByteTag fTag;
25         SkScalar fMinimum;
26         SkScalar fDefault;
27         SkScalar fMaximum;
28     };
29     typedef skia_private::STArray<4, AxisDefinition, true> AxisDefinitions;
30 
31     virtual bool scanFile(SkStreamAsset* stream, int* numFaces) const = 0;
32     virtual bool scanFace(SkStreamAsset* stream, int faceIndex, int* numInstances) const = 0;
33     /* instanceIndex 0 is the default instance, 1 to numInstances are the named instances. */
34     virtual bool scanInstance(SkStreamAsset* stream,
35                               int faceIndex,
36                               int instanceIndex,
37                               SkString* name,
38                               SkFontStyle* style,
39                               bool* isFixedPitch,
40                               AxisDefinitions* axes) const = 0;
41 };
42 
43 #endif // SKFONTSCANNER_H_
44