1/*
2 * Copyright (C) 2015 The Android Open Source Project
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#ifndef MINIKIN_TEST_MINIKIN_FONT_FOR_TEST_H
18#define MINIKIN_TEST_MINIKIN_FONT_FOR_TEST_H
19
20#include <minikin/MinikinFont.h>
21
22class SkTypeface;
23
24class MinikinFontForTest : public android::MinikinFont {
25public:
26    explicit MinikinFontForTest(const std::string& font_path);
27    MinikinFontForTest(const std::string& font_path, SkTypeface* typeface);
28    ~MinikinFontForTest();
29
30    // MinikinFont overrides.
31    float GetHorizontalAdvance(uint32_t glyph_id, const android::MinikinPaint &paint) const;
32    void GetBounds(android::MinikinRect* bounds, uint32_t glyph_id,
33            const android::MinikinPaint& paint) const;
34    const void* GetTable(uint32_t tag, size_t* size, android::MinikinDestroyFunc* destroy);
35
36    const std::string& fontPath() const { return mFontPath; }
37private:
38    SkTypeface *mTypeface;
39    const std::string mFontPath;
40};
41
42#endif  // MINIKIN_TEST_MINIKIN_FONT_FOR_TEST_H
43