Flutter Engine
The Flutter Engine
font_features.cc
Go to the documentation of this file.
1/*
2 * Copyright 2019 Google, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "font_features.h"
18
19#include <sstream>
20
21namespace txt {
22
23void FontFeatures::SetFeature(std::string tag, int value) {
24 feature_map_[tag] = value;
25}
26
28 if (feature_map_.empty())
29 return "";
30
31 std::ostringstream stream;
32
33 for (const auto& kv : feature_map_) {
34 if (stream.tellp()) {
35 stream << ',';
36 }
37 stream << kv.first << '=' << kv.second;
38 }
39
40 return stream.str();
41}
42
43const std::map<std::string, int>& FontFeatures::GetFontFeatures() const {
44 return feature_map_;
45}
46
47void FontVariations::SetAxisValue(std::string tag, float value) {
48 axis_map_[tag] = value;
49}
50
51const std::map<std::string, float>& FontVariations::GetAxisValues() const {
52 return axis_map_;
53}
54
55} // namespace txt
void SetFeature(std::string tag, int value)
const std::map< std::string, int > & GetFontFeatures() const
std::string GetFeatureSettings() const
const std::map< std::string, float > & GetAxisValues() const
void SetAxisValue(std::string tag, float value)
uint8_t value