| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_FONT_LOADER_MAC_H_ | 5 #ifndef CHROME_COMMON_FONT_LOADER_MAC_H_ |
| 6 #define CHROME_COMMON_FONT_LOADER_MAC_H_ | 6 #define CHROME_COMMON_FONT_LOADER_MAC_H_ |
| 7 | 7 |
| 8 #include <ApplicationServices/ApplicationServices.h> |
| 9 |
| 8 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| 9 #include "base/string16.h" | 11 #include "base/string16.h" |
| 10 | 12 |
| 11 #ifdef __OBJC__ | 13 #ifdef __OBJC__ |
| 12 @class NSFont; | 14 @class NSFont; |
| 13 #else | 15 #else |
| 14 class NSFont; | 16 class NSFont; |
| 15 #endif | 17 #endif |
| 16 | 18 |
| 17 typedef uintptr_t ATSFontContainerRef; | |
| 18 | |
| 19 // Provides functionality to transmit fonts over IPC. | 19 // Provides functionality to transmit fonts over IPC. |
| 20 // | 20 // |
| 21 // Note about font formats: .dfont (datafork suitcase) fonts are currently not | 21 // Note about font formats: .dfont (datafork suitcase) fonts are currently not |
| 22 // supported by this code since ATSFontActivateFromMemory() can't handle them | 22 // supported by this code since ATSFontActivateFromMemory() can't handle them |
| 23 // directly. | 23 // directly. |
| 24 | 24 |
| 25 class FontLoader { | 25 class FontLoader { |
| 26 public: | 26 public: |
| 27 // Load a font specified by |font_to_encode| into a shared memory buffer | 27 // Load a font specified by |font_to_encode| into a shared memory buffer |
| 28 // suitable for sending over IPC. | 28 // suitable for sending over IPC. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 // returns true on success, false on failure. | 46 // returns true on success, false on failure. |
| 47 // |font_container| - A font container corresponding to the designated font. | 47 // |font_container| - A font container corresponding to the designated font. |
| 48 // The caller is responsible for releasing this value via ATSFontDeactivate() | 48 // The caller is responsible for releasing this value via ATSFontDeactivate() |
| 49 // when done | 49 // when done |
| 50 static bool ATSFontContainerFromBuffer(base::SharedMemoryHandle font_data, | 50 static bool ATSFontContainerFromBuffer(base::SharedMemoryHandle font_data, |
| 51 uint32 font_data_size, | 51 uint32 font_data_size, |
| 52 ATSFontContainerRef* font_container); | 52 ATSFontContainerRef* font_container); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 #endif // CHROME_COMMON_FONT_LOADER_MAC_H_ | 55 #endif // CHROME_COMMON_FONT_LOADER_MAC_H_ |
| OLD | NEW |