Seigo Nonaka 6b1c227da6 Improve Paint.measureText and Paint.hasGlyph for variation sequences.
Before this patch, the font fallback chain iterated all installed font
families if a variation selector was specified.

This CL narrows down the range of iteration.
To decide the font family for the variation sequence, we need to search
for both the variation sequence and its base code point.
The new range of the iteration is a union of them.

With this change, the running time of Paint.hasGlyph for the variation
sequence improves 50% and the running time of Paint.measureText for the
variation sequence improves 40% for the large text case on Nexus 6
userdebug.

Bug: 26784699
Bug: 11750374

Change-Id: Iced1349e3ca750821d8882c551551f65bb569794
2016-02-17 16:01:20 +09:00

33 lines
978 B
C++

/*
* Copyright (C) 2013 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_CMAP_COVERAGE_H
#define MINIKIN_CMAP_COVERAGE_H
#include <minikin/SparseBitSet.h>
namespace android {
class CmapCoverage {
public:
static bool getCoverage(SparseBitSet &coverage, const uint8_t* cmap_data, size_t cmap_size,
bool* has_cmap_format14_subtable);
};
} // namespace android
#endif // MINIKIN_CMAP_COVERAGE_H