AndroidSystemFontIterator.h (1219B)
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef AndroidSystemFontIterator_h__ 7 #define AndroidSystemFontIterator_h__ 8 9 #include "mozilla/Maybe.h" 10 11 #include <android/font.h> 12 #include <android/system_fonts.h> 13 14 namespace mozilla { 15 16 class __attribute__(( 17 availability(android, introduced = 29))) AndroidFont final { 18 public: 19 explicit AndroidFont(AFont* _Nullable aFont) : mFont(aFont) {}; 20 21 AndroidFont() = delete; 22 AndroidFont(const AndroidFont&) = delete; 23 24 AndroidFont(AndroidFont&& aSrc) { 25 mFont = aSrc.mFont; 26 aSrc.mFont = nullptr; 27 } 28 29 ~AndroidFont(); 30 31 const char* _Nullable GetFontFilePath(); 32 33 private: 34 AFont* _Nullable mFont; 35 }; 36 37 class __attribute__(( 38 availability(android, introduced = 29))) AndroidSystemFontIterator final { 39 public: 40 AndroidSystemFontIterator(); 41 ~AndroidSystemFontIterator(); 42 43 static void Preload(); 44 45 Maybe<AndroidFont> Next(); 46 47 private: 48 ASystemFontIterator* _Nullable mIterator; 49 }; 50 51 } // namespace mozilla 52 53 #endif