flutter_flutter/tests/MinikinFontForTest.h
Seigo Nonaka 6f9966ea7c Introduce multiple language based font fallback.
The motivation of this CL is enhance the font fallback score design
to support multiple language font fallback.

This CL contains following changes:
- Break language based font score into two: script-based score and
  primary-language-based score.
- The primary-language-based score is 0 if the script-based score is 0.
  If the script-based score is not 0 and the primary language is the
  as same as the requested one, the font gets an extra score of 1.
- The language score gets a higher multiplier for languages higher in
  the locale list.

Bug: 25122318
Bug: 26168983
Change-Id: Ib999997a88e6977e341f4c325e2a1b41a59db2d5
2016-01-15 14:35:14 +09:00

43 lines
1.4 KiB
C++

/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINIKIN_TEST_MINIKIN_FONT_FOR_TEST_H
#define MINIKIN_TEST_MINIKIN_FONT_FOR_TEST_H
#include <minikin/MinikinFont.h>
class SkTypeface;
class MinikinFontForTest : public android::MinikinFont {
public:
explicit MinikinFontForTest(const std::string& font_path);
~MinikinFontForTest();
// MinikinFont overrides.
float GetHorizontalAdvance(uint32_t glyph_id, const android::MinikinPaint &paint) const;
void GetBounds(android::MinikinRect* bounds, uint32_t glyph_id,
const android::MinikinPaint& paint) const;
bool GetTable(uint32_t tag, uint8_t *buf, size_t *size);
int32_t GetUniqueId() const;
const std::string& fontPath() const { return mFontPath; }
private:
SkTypeface *mTypeface;
const std::string mFontPath;
};
#endif // MINIKIN_TEST_MINIKIN_FONT_FOR_TEST_H