Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 | |
Seigo Nonaka | 5dd6dd5 | 2021-02-11 20:02:27 -0800 | [diff] [blame] | 17 | #include <nativehelper/ScopedPrimitiveArray.h> |
| 18 | #include <nativehelper/ScopedUtfChars.h> |
| 19 | #include "FontUtils.h" |
| 20 | #include "GraphicsJNI.h" |
Ben Wagner | f462c24 | 2015-01-12 14:26:14 -0500 | [diff] [blame] | 21 | #include "SkData.h" |
Ben Wagner | b8e367f | 2015-11-06 11:57:09 -0500 | [diff] [blame] | 22 | #include "SkFontMgr.h" |
Ben Wagner | f462c24 | 2015-01-12 14:26:14 -0500 | [diff] [blame] | 23 | #include "SkRefCnt.h" |
Kevin Lubick | 1175dc0 | 2022-02-28 12:41:27 -0500 | [diff] [blame] | 24 | #include "SkStream.h" |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 25 | #include "SkTypeface.h" |
Raph Levien | d573794 | 2014-06-01 22:52:12 -0700 | [diff] [blame] | 26 | #include "Utils.h" |
Seigo Nonaka | 5dd6dd5 | 2021-02-11 20:02:27 -0800 | [diff] [blame] | 27 | #include "fonts/Font.h" |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 28 | |
sergeyv | dccca44 | 2016-03-21 15:38:21 -0700 | [diff] [blame] | 29 | #include <hwui/MinikinSkia.h> |
sergeyv | bad9918 | 2016-03-17 11:24:22 -0700 | [diff] [blame] | 30 | #include <hwui/Typeface.h> |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 31 | #include <minikin/FontFamily.h> |
Seigo Nonaka | 20866c1 | 2017-10-26 16:02:01 -0700 | [diff] [blame] | 32 | #include <minikin/LocaleList.h> |
Jagadeesh Pakaravoor | b624af3 | 2020-05-01 00:01:40 +0000 | [diff] [blame] | 33 | #include <ui/FatVector.h> |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 34 | |
Ben Wagner | b8e367f | 2015-11-06 11:57:09 -0500 | [diff] [blame] | 35 | #include <memory> |
| 36 | |
Seigo Nonaka | 5dd6dd5 | 2021-02-11 20:02:27 -0800 | [diff] [blame] | 37 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 38 | // |
| 39 | // The following JNI methods are kept only for compatibility reasons due to hidden API accesses. |
| 40 | // |
| 41 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 42 | |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 43 | namespace android { |
| 44 | |
Tomislav Novak | e537b18 | 2023-05-02 14:35:29 -0700 | [diff] [blame] | 45 | namespace { |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 46 | struct NativeFamilyBuilder { |
Seigo Nonaka | 5b6347a | 2017-03-31 14:30:05 -0700 | [diff] [blame] | 47 | NativeFamilyBuilder(uint32_t langId, int variant) |
Seigo Nonaka | 0ca492f | 2018-05-25 14:52:22 -0700 | [diff] [blame] | 48 | : langId(langId), variant(static_cast<minikin::FamilyVariant>(variant)) {} |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 49 | uint32_t langId; |
Seigo Nonaka | 0ca492f | 2018-05-25 14:52:22 -0700 | [diff] [blame] | 50 | minikin::FamilyVariant variant; |
Seigo Nonaka | 760d351 | 2020-10-01 12:29:03 -0700 | [diff] [blame] | 51 | std::vector<std::shared_ptr<minikin::Font>> fonts; |
Seigo Nonaka | ac873c9 | 2017-03-07 15:34:53 -0800 | [diff] [blame] | 52 | std::vector<minikin::FontVariation> axes; |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 53 | }; |
Tomislav Novak | e537b18 | 2023-05-02 14:35:29 -0700 | [diff] [blame] | 54 | } // namespace |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 55 | |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 56 | static inline NativeFamilyBuilder* toNativeBuilder(jlong ptr) { |
| 57 | return reinterpret_cast<NativeFamilyBuilder*>(ptr); |
| 58 | } |
| 59 | |
| 60 | static inline FontFamilyWrapper* toFamily(jlong ptr) { |
| 61 | return reinterpret_cast<FontFamilyWrapper*>(ptr); |
| 62 | } |
| 63 | |
| 64 | template<typename Ptr> static inline jlong toJLong(Ptr ptr) { |
| 65 | return reinterpret_cast<jlong>(ptr); |
| 66 | } |
| 67 | |
Roozbeh Pournader | 99975a3 | 2017-08-09 09:42:20 -0700 | [diff] [blame] | 68 | static jlong FontFamily_initBuilder(JNIEnv* env, jobject clazz, jstring langs, jint variant) { |
Seigo Nonaka | 5b6347a | 2017-03-31 14:30:05 -0700 | [diff] [blame] | 69 | NativeFamilyBuilder* builder; |
Roozbeh Pournader | 99975a3 | 2017-08-09 09:42:20 -0700 | [diff] [blame] | 70 | if (langs != nullptr) { |
| 71 | ScopedUtfChars str(env, langs); |
Seigo Nonaka | 20866c1 | 2017-10-26 16:02:01 -0700 | [diff] [blame] | 72 | builder = new NativeFamilyBuilder(minikin::registerLocaleList(str.c_str()), variant); |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 73 | } else { |
Seigo Nonaka | 20866c1 | 2017-10-26 16:02:01 -0700 | [diff] [blame] | 74 | builder = new NativeFamilyBuilder(minikin::registerLocaleList(""), variant); |
Raph Levien | f9e3d31 | 2014-05-27 16:33:11 -0700 | [diff] [blame] | 75 | } |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 76 | return toJLong(builder); |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 77 | } |
| 78 | |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 79 | static jlong FontFamily_create(CRITICAL_JNI_PARAMS_COMMA jlong builderPtr) { |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 80 | if (builderPtr == 0) { |
| 81 | return 0; |
| 82 | } |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 83 | NativeFamilyBuilder* builder = toNativeBuilder(builderPtr); |
Seigo Nonaka | fcd2af9 | 2018-01-30 19:09:28 -0800 | [diff] [blame] | 84 | if (builder->fonts.empty()) { |
| 85 | return 0; |
| 86 | } |
Seigo Nonaka | 9e233cd5 | 2022-10-24 14:40:41 +0900 | [diff] [blame] | 87 | std::shared_ptr<minikin::FontFamily> family = minikin::FontFamily::create( |
| 88 | builder->langId, builder->variant, std::move(builder->fonts), |
Seigo Nonaka | 0579097 | 2023-05-25 19:42:52 +0900 | [diff] [blame] | 89 | true /* isCustomFallback */, false /* isDefaultFallback */, |
| 90 | minikin::VariationFamilyType::None); |
Seigo Nonaka | fcd2af9 | 2018-01-30 19:09:28 -0800 | [diff] [blame] | 91 | if (family->getCoverage().length() == 0) { |
Seigo Nonaka | 5b6347a | 2017-03-31 14:30:05 -0700 | [diff] [blame] | 92 | return 0; |
| 93 | } |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 94 | return toJLong(new FontFamilyWrapper(std::move(family))); |
Seigo Nonaka | 5b6347a | 2017-03-31 14:30:05 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 97 | static void releaseBuilder(jlong builderPtr) { |
| 98 | delete toNativeBuilder(builderPtr); |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 99 | } |
| 100 | |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 101 | static jlong FontFamily_getBuilderReleaseFunc(CRITICAL_JNI_PARAMS) { |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 102 | return toJLong(&releaseBuilder); |
| 103 | } |
| 104 | |
| 105 | static void releaseFamily(jlong familyPtr) { |
| 106 | delete toFamily(familyPtr); |
| 107 | } |
| 108 | |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 109 | static jlong FontFamily_getFamilyReleaseFunc(CRITICAL_JNI_PARAMS) { |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 110 | return toJLong(&releaseFamily); |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 111 | } |
| 112 | |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 113 | static bool addSkTypeface(NativeFamilyBuilder* builder, sk_sp<SkData>&& data, int ttcIndex, |
Seigo Nonaka | 0606a88 | 2018-01-31 19:29:40 -0800 | [diff] [blame] | 114 | jint weight, jint italic) { |
Ben Wagner | 78d58fd | 2020-07-14 16:52:13 +0000 | [diff] [blame] | 115 | FatVector<SkFontArguments::VariationPosition::Coordinate, 2> skVariation; |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 116 | for (const auto& axis : builder->axes) { |
Ben Wagner | 78d58fd | 2020-07-14 16:52:13 +0000 | [diff] [blame] | 117 | skVariation.push_back({axis.axisTag, axis.value}); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | const size_t fontSize = data->size(); |
| 121 | const void* fontPtr = data->data(); |
| 122 | std::unique_ptr<SkStreamAsset> fontData(new SkMemoryStream(std::move(data))); |
| 123 | |
Ben Wagner | 78d58fd | 2020-07-14 16:52:13 +0000 | [diff] [blame] | 124 | SkFontArguments args; |
| 125 | args.setCollectionIndex(ttcIndex); |
| 126 | args.setVariationDesignPosition({skVariation.data(), static_cast<int>(skVariation.size())}); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 127 | |
| 128 | sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
Ben Wagner | 78d58fd | 2020-07-14 16:52:13 +0000 | [diff] [blame] | 129 | sk_sp<SkTypeface> face(fm->makeFromStream(std::move(fontData), args)); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 130 | if (face == NULL) { |
| 131 | ALOGE("addFont failed to create font, invalid request"); |
| 132 | builder->axes.clear(); |
| 133 | return false; |
| 134 | } |
Seigo Nonaka | c706414 | 2017-02-10 16:53:31 +0900 | [diff] [blame] | 135 | std::shared_ptr<minikin::MinikinFont> minikinFont = |
Seigo Nonaka | 5dd6dd5 | 2021-02-11 20:02:27 -0800 | [diff] [blame] | 136 | std::make_shared<MinikinFontSkia>(std::move(face), fonts::getNewSourceId(), fontPtr, |
| 137 | fontSize, "", ttcIndex, builder->axes); |
Seigo Nonaka | 0606a88 | 2018-01-31 19:29:40 -0800 | [diff] [blame] | 138 | minikin::Font::Builder fontBuilder(minikinFont); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 139 | |
Seigo Nonaka | 0606a88 | 2018-01-31 19:29:40 -0800 | [diff] [blame] | 140 | if (weight != RESOLVE_BY_FONT_TABLE) { |
| 141 | fontBuilder.setWeight(weight); |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 142 | } |
Seigo Nonaka | 0606a88 | 2018-01-31 19:29:40 -0800 | [diff] [blame] | 143 | if (italic != RESOLVE_BY_FONT_TABLE) { |
| 144 | fontBuilder.setSlant(static_cast<minikin::FontStyle::Slant>(italic != 0)); |
| 145 | } |
| 146 | builder->fonts.push_back(fontBuilder.build()); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 147 | builder->axes.clear(); |
| 148 | return true; |
Raph Levien | d573794 | 2014-06-01 22:52:12 -0700 | [diff] [blame] | 149 | } |
Raph Levien | d573794 | 2014-06-01 22:52:12 -0700 | [diff] [blame] | 150 | |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 151 | static void release_global_ref(const void* /*data*/, void* context) { |
Derek Sollenberger | c5882c4 | 2019-10-25 11:11:32 -0400 | [diff] [blame] | 152 | JNIEnv* env = GraphicsJNI::getJNIEnv(); |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 153 | bool needToAttach = (env == NULL); |
| 154 | if (needToAttach) { |
Derek Sollenberger | c5882c4 | 2019-10-25 11:11:32 -0400 | [diff] [blame] | 155 | env = GraphicsJNI::attachJNIEnv("release_font_data"); |
| 156 | if (env == nullptr) { |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 157 | ALOGE("failed to attach to thread to release global ref."); |
| 158 | return; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | jobject obj = reinterpret_cast<jobject>(context); |
| 163 | env->DeleteGlobalRef(obj); |
| 164 | |
| 165 | if (needToAttach) { |
Derek Sollenberger | c5882c4 | 2019-10-25 11:11:32 -0400 | [diff] [blame] | 166 | GraphicsJNI::detachJNIEnv(); |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 167 | } |
| 168 | } |
| 169 | |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 170 | static jboolean FontFamily_addFont(JNIEnv* env, jobject clazz, jlong builderPtr, jobject bytebuf, |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 171 | jint ttcIndex, jint weight, jint isItalic) { |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 172 | NPE_CHECK_RETURN_ZERO(env, bytebuf); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 173 | NativeFamilyBuilder* builder = reinterpret_cast<NativeFamilyBuilder*>(builderPtr); |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 174 | const void* fontPtr = env->GetDirectBufferAddress(bytebuf); |
| 175 | if (fontPtr == NULL) { |
| 176 | ALOGE("addFont failed to create font, buffer invalid"); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 177 | builder->axes.clear(); |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 178 | return false; |
| 179 | } |
| 180 | jlong fontSize = env->GetDirectBufferCapacity(bytebuf); |
| 181 | if (fontSize < 0) { |
| 182 | ALOGE("addFont failed to create font, buffer size invalid"); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 183 | builder->axes.clear(); |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 184 | return false; |
| 185 | } |
| 186 | jobject fontRef = MakeGlobalRefOrDie(env, bytebuf); |
Ben Wagner | d8b5c31 | 2016-08-03 15:55:25 -0400 | [diff] [blame] | 187 | sk_sp<SkData> data(SkData::MakeWithProc(fontPtr, fontSize, |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 188 | release_global_ref, reinterpret_cast<void*>(fontRef))); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 189 | return addSkTypeface(builder, std::move(data), ttcIndex, weight, isItalic); |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 190 | } |
| 191 | |
Seigo Nonaka | 8b48e62 | 2017-01-07 15:33:38 +0900 | [diff] [blame] | 192 | static jboolean FontFamily_addFontWeightStyle(JNIEnv* env, jobject clazz, jlong builderPtr, |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 193 | jobject font, jint ttcIndex, jint weight, jint isItalic) { |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 194 | NPE_CHECK_RETURN_ZERO(env, font); |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 195 | NativeFamilyBuilder* builder = toNativeBuilder(builderPtr); |
Raph Levien | 296bf8c | 2016-04-06 15:23:57 -0700 | [diff] [blame] | 196 | const void* fontPtr = env->GetDirectBufferAddress(font); |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 197 | if (fontPtr == NULL) { |
| 198 | ALOGE("addFont failed to create font, buffer invalid"); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 199 | builder->axes.clear(); |
Ben Wagner | b8e367f | 2015-11-06 11:57:09 -0500 | [diff] [blame] | 200 | return false; |
| 201 | } |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 202 | jlong fontSize = env->GetDirectBufferCapacity(font); |
| 203 | if (fontSize < 0) { |
| 204 | ALOGE("addFont failed to create font, buffer size invalid"); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 205 | builder->axes.clear(); |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 206 | return false; |
| 207 | } |
| 208 | jobject fontRef = MakeGlobalRefOrDie(env, font); |
Ben Wagner | d8b5c31 | 2016-08-03 15:55:25 -0400 | [diff] [blame] | 209 | sk_sp<SkData> data(SkData::MakeWithProc(fontPtr, fontSize, |
Ben Wagner | fffcf0a | 2016-01-28 16:05:33 -0500 | [diff] [blame] | 210 | release_global_ref, reinterpret_cast<void*>(fontRef))); |
Seigo Nonaka | 20e5d91 | 2017-01-18 20:31:27 +0900 | [diff] [blame] | 211 | return addSkTypeface(builder, std::move(data), ttcIndex, weight, isItalic); |
Raph Levien | 117cbeb | 2014-08-25 13:47:16 -0700 | [diff] [blame] | 212 | } |
| 213 | |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 214 | static void FontFamily_addAxisValue(CRITICAL_JNI_PARAMS_COMMA jlong builderPtr, jint tag, jfloat value) { |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 215 | NativeFamilyBuilder* builder = toNativeBuilder(builderPtr); |
Seigo Nonaka | ac873c9 | 2017-03-07 15:34:53 -0800 | [diff] [blame] | 216 | builder->axes.push_back({static_cast<minikin::AxisTag>(tag), value}); |
| 217 | } |
| 218 | |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 219 | /////////////////////////////////////////////////////////////////////////////// |
| 220 | |
Daniel Micay | 76f6a86 | 2015-09-19 17:31:01 -0400 | [diff] [blame] | 221 | static const JNINativeMethod gFontFamilyMethods[] = { |
Seigo Nonaka | abe5031 | 2018-02-20 14:49:59 -0800 | [diff] [blame] | 222 | { "nInitBuilder", "(Ljava/lang/String;I)J", (void*)FontFamily_initBuilder }, |
| 223 | { "nCreateFamily", "(J)J", (void*)FontFamily_create }, |
| 224 | { "nGetBuilderReleaseFunc", "()J", (void*)FontFamily_getBuilderReleaseFunc }, |
| 225 | { "nGetFamilyReleaseFunc", "()J", (void*)FontFamily_getFamilyReleaseFunc }, |
| 226 | { "nAddFont", "(JLjava/nio/ByteBuffer;III)Z", (void*)FontFamily_addFont }, |
| 227 | { "nAddFontWeightStyle", "(JLjava/nio/ByteBuffer;III)Z", |
Ben Wagner | b8e367f | 2015-11-06 11:57:09 -0500 | [diff] [blame] | 228 | (void*)FontFamily_addFontWeightStyle }, |
Seigo Nonaka | ac873c9 | 2017-03-07 15:34:53 -0800 | [diff] [blame] | 229 | { "nAddAxisValue", "(JIF)V", (void*)FontFamily_addAxisValue }, |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | int register_android_graphics_FontFamily(JNIEnv* env) |
| 233 | { |
Ben Wagner | b8e367f | 2015-11-06 11:57:09 -0500 | [diff] [blame] | 234 | int err = RegisterMethodsOrDie(env, "android/graphics/FontFamily", gFontFamilyMethods, |
| 235 | NELEM(gFontFamilyMethods)); |
| 236 | |
Seigo Nonaka | 9ff994d | 2016-11-30 14:04:21 -0800 | [diff] [blame] | 237 | init_FontUtils(env); |
Ben Wagner | b8e367f | 2015-11-06 11:57:09 -0500 | [diff] [blame] | 238 | return err; |
Raph Levien | 1a73f732 | 2014-01-30 16:06:28 -0800 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | } |