| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 static void releaseTableData(void* userData) | 103 static void releaseTableData(void* userData) |
| 104 { | 104 { |
| 105 CFDataRef cfData = reinterpret_cast<CFDataRef>(userData); | 105 CFDataRef cfData = reinterpret_cast<CFDataRef>(userData); |
| 106 CFRelease(cfData); | 106 CFRelease(cfData); |
| 107 } | 107 } |
| 108 | 108 |
| 109 static hb_blob_t* harfBuzzCoreTextGetTable(hb_face_t* face, hb_tag_t tag, void*
userData) | 109 static hb_blob_t* harfBuzzCoreTextGetTable(hb_face_t* face, hb_tag_t tag, void*
userData) |
| 110 { | 110 { |
| 111 CGFontRef cgFont = reinterpret_cast<CGFontRef>(userData); | 111 CGFontRef cgFont = reinterpret_cast<CGFontRef>(userData); |
| 112 if (!cgFont) |
| 113 return 0; |
| 112 CFDataRef cfData = CGFontCopyTableForTag(cgFont, tag); | 114 CFDataRef cfData = CGFontCopyTableForTag(cgFont, tag); |
| 113 if (!cfData) | 115 if (!cfData) |
| 114 return 0; | 116 return 0; |
| 115 | 117 |
| 116 const char* data = reinterpret_cast<const char*>(CFDataGetBytePtr(cfData)); | 118 const char* data = reinterpret_cast<const char*>(CFDataGetBytePtr(cfData)); |
| 117 const size_t length = CFDataGetLength(cfData); | 119 const size_t length = CFDataGetLength(cfData); |
| 118 if (!data || !length) | 120 if (!data || !length) |
| 119 return 0; | 121 return 0; |
| 120 return hb_blob_create(data, length, HB_MEMORY_MODE_READONLY, reinterpret_cas
t<void*>(const_cast<__CFData*>(cfData)), releaseTableData); | 122 return hb_blob_create(data, length, HB_MEMORY_MODE_READONLY, reinterpret_cas
t<void*>(const_cast<__CFData*>(cfData)), releaseTableData); |
| 121 } | 123 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 135 hb_font_set_funcs(font, harfBuzzCoreTextGetFontFuncs(), m_platformData, 0); | 137 hb_font_set_funcs(font, harfBuzzCoreTextGetFontFuncs(), m_platformData, 0); |
| 136 const float size = m_platformData->m_textSize; | 138 const float size = m_platformData->m_textSize; |
| 137 hb_font_set_ppem(font, size, size); | 139 hb_font_set_ppem(font, size, size); |
| 138 const int scale = (1 << 16) * static_cast<int>(size); | 140 const int scale = (1 << 16) * static_cast<int>(size); |
| 139 hb_font_set_scale(font, scale, scale); | 141 hb_font_set_scale(font, scale, scale); |
| 140 hb_font_make_immutable(font); | 142 hb_font_make_immutable(font); |
| 141 return font; | 143 return font; |
| 142 } | 144 } |
| 143 | 145 |
| 144 } // namespace blink | 146 } // namespace blink |
| OLD | NEW |