Skia
2D Graphics Library
SkFontArguments.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 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 SkFontArguments_DEFINED
9 #define SkFontArguments_DEFINED
10 
11 #include "include/core/SkColor.h"
12 #include "include/core/SkScalar.h"
13 #include "include/core/SkTypes.h"
14 
18  struct Coordinate {
20  float value;
21  };
24  };
25 
33  struct Palette {
34  struct Override {
35  int index;
37  };
38  int index;
41  };
42 
44  : fCollectionIndex(0)
45  , fVariationDesignPosition{nullptr, 0}
46  , fPalette{0, nullptr, 0} {}
47 
53  SkFontArguments& setCollectionIndex(int collectionIndex) {
54  fCollectionIndex = collectionIndex;
55  return *this;
56  }
57 
66  fVariationDesignPosition.coordinates = position.coordinates;
67  fVariationDesignPosition.coordinateCount = position.coordinateCount;
68  return *this;
69  }
70 
71  int getCollectionIndex() const {
72  return fCollectionIndex;
73  }
74 
76  return fVariationDesignPosition;
77  }
78 
80  fPalette.index = palette.index;
81  fPalette.overrides = palette.overrides;
82  fPalette.overrideCount = palette.overrideCount;
83  return *this;
84  }
85 
86  Palette getPalette() const { return fPalette; }
87 
88 private:
89  int fCollectionIndex;
90  VariationPosition fVariationDesignPosition;
91  Palette fPalette;
92 };
93 
94 #endif
Types, consts, functions, and macros for colors.
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:37
uint32_t SkFourByteTag
Definition: SkTypes.h:158
Definition: SkFontArguments.h:34
int index
Definition: SkFontArguments.h:35
SkColor color
Definition: SkFontArguments.h:36
Specify a palette to use and overrides for palette entries.
Definition: SkFontArguments.h:33
int index
Definition: SkFontArguments.h:38
const Override * overrides
Definition: SkFontArguments.h:39
int overrideCount
Definition: SkFontArguments.h:40
Definition: SkFontArguments.h:18
float value
Definition: SkFontArguments.h:20
SkFourByteTag axis
Definition: SkFontArguments.h:19
Definition: SkFontArguments.h:17
const Coordinate * coordinates
Definition: SkFontArguments.h:22
int coordinateCount
Definition: SkFontArguments.h:23
Represents a set of actual arguments for a font.
Definition: SkFontArguments.h:16
SkFontArguments()
Definition: SkFontArguments.h:43
VariationPosition getVariationDesignPosition() const
Definition: SkFontArguments.h:75
SkFontArguments & setPalette(Palette palette)
Definition: SkFontArguments.h:79
Palette getPalette() const
Definition: SkFontArguments.h:86
int getCollectionIndex() const
Definition: SkFontArguments.h:71
SkFontArguments & setVariationDesignPosition(VariationPosition position)
Specify a position in the variation design space.
Definition: SkFontArguments.h:65
SkFontArguments & setCollectionIndex(int collectionIndex)
Specify the index of the desired font.
Definition: SkFontArguments.h:53