c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
80 lines
2.5 KiB
C++
80 lines
2.5 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkFontArguments_DEFINED
|
|
#define SkFontArguments_DEFINED
|
|
|
|
#include "include/core/SkScalar.h"
|
|
#include "include/core/SkTypes.h"
|
|
|
|
/** Represents a set of actual arguments for a font. */
|
|
struct SkFontArguments {
|
|
struct VariationPosition {
|
|
struct Coordinate {
|
|
SkFourByteTag axis;
|
|
float value;
|
|
};
|
|
const Coordinate* coordinates;
|
|
int coordinateCount;
|
|
};
|
|
// deprecated, use VariationPosition::Coordinate instead
|
|
struct Axis {
|
|
SkFourByteTag fTag;
|
|
float fStyleValue;
|
|
};
|
|
|
|
SkFontArguments() : fCollectionIndex(0), fVariationDesignPosition{nullptr, 0} {}
|
|
|
|
/** Specify the index of the desired font.
|
|
*
|
|
* Font formats like ttc, dfont, cff, cid, pfr, t42, t1, and fon may actually be indexed
|
|
* collections of fonts.
|
|
*/
|
|
SkFontArguments& setCollectionIndex(int collectionIndex) {
|
|
fCollectionIndex = collectionIndex;
|
|
return *this;
|
|
}
|
|
|
|
// deprecated, use setVariationDesignPosition instead.
|
|
SkFontArguments& setAxes(const Axis* axes, int axisCount) {
|
|
fVariationDesignPosition.coordinates =
|
|
reinterpret_cast<const VariationPosition::Coordinate*>(axes);
|
|
fVariationDesignPosition.coordinateCount = axisCount;
|
|
return *this;
|
|
}
|
|
|
|
/** Specify a position in the variation design space.
|
|
*
|
|
* Any axis not specified will use the default value.
|
|
* Any specified axis not actually present in the font will be ignored.
|
|
*
|
|
* @param position not copied. The value must remain valid for life of SkFontArguments.
|
|
*/
|
|
SkFontArguments& setVariationDesignPosition(VariationPosition position) {
|
|
fVariationDesignPosition.coordinates = position.coordinates;
|
|
fVariationDesignPosition.coordinateCount = position.coordinateCount;
|
|
return *this;
|
|
}
|
|
|
|
int getCollectionIndex() const {
|
|
return fCollectionIndex;
|
|
}
|
|
// deprecated, use getVariationDesignPosition instead.
|
|
const Axis* getAxes(int* axisCount) const {
|
|
*axisCount = fVariationDesignPosition.coordinateCount;
|
|
return reinterpret_cast<const Axis*>(fVariationDesignPosition.coordinates);
|
|
}
|
|
VariationPosition getVariationDesignPosition() const {
|
|
return fVariationDesignPosition;
|
|
}
|
|
private:
|
|
int fCollectionIndex;
|
|
VariationPosition fVariationDesignPosition;
|
|
};
|
|
|
|
#endif
|