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 17 // Definitions internal to Minikin 18 #define LOG_TAG "Minikin" 19 20 #include "MinikinInternal.h" 21 #include "HbFontCache.h" 22 23 #include <log/log.h> 24 25 namespace minikin { 26 27 std::recursive_mutex gMinikinLock; 28 assertMinikinLocked()29void assertMinikinLocked() { 30 #ifdef ENABLE_RACE_DETECTION 31 LOG_ALWAYS_FATAL_IF(gMinikinLock.tryLock() == 0); 32 #endif 33 } 34 getFontTable(const MinikinFont * minikinFont,uint32_t tag)35hb_blob_t* getFontTable(const MinikinFont* minikinFont, uint32_t tag) { 36 assertMinikinLocked(); 37 hb_font_t* font = getHbFontLocked(minikinFont); 38 hb_face_t* face = hb_font_get_face(font); 39 hb_blob_t* blob = hb_face_reference_table(face, tag); 40 hb_font_destroy(font); 41 return blob; 42 } 43 44 } // namespace minikin 45