summaryrefslogtreecommitdiffstats
path: root/chrome/common/font_loader_mac.h
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 03:29:26 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 03:29:26 +0000
commit2019966658e19a873744641668e134b92123f1d5 (patch)
tree853ac0828cc46bec543851b7c57c70a3bb1fc06e /chrome/common/font_loader_mac.h
parentf7d992aa311c3cec1fc95ce06338b129f4b34cbe (diff)
downloadchromium_src-2019966658e19a873744641668e134b92123f1d5.zip
chromium_src-2019966658e19a873744641668e134b92123f1d5.tar.gz
chromium_src-2019966658e19a873744641668e134b92123f1d5.tar.bz2
Mac: More pluming for OOP font loading
* Add font_descriptor and corresponding pluming to send an NSFont over IPC. * Rejigger font_loader to accept an NSFont as input and output an ATSFontContainerRef. The reasoning behind this is that WebKit ultimately controls the font lifetime and we can only deactivate the font container once the font is no longer in use. BUG=29729 Test=Unit tests should pass. Review URL: http://codereview.chromium.org/2804001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/font_loader_mac.h')
-rw-r--r--chrome/common/font_loader_mac.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/chrome/common/font_loader_mac.h b/chrome/common/font_loader_mac.h
index 8d2467f..2ec42bce 100644
--- a/chrome/common/font_loader_mac.h
+++ b/chrome/common/font_loader_mac.h
@@ -10,6 +10,12 @@
#include "base/shared_memory.h"
#include "base/string16.h"
+#ifdef __OBJC__
+@class NSFont;
+#else
+class NSFont;
+#endif
+
// Provides functionality to transmit fonts over IPC.
//
// Note about font formats: .dfont (datafork suitcase) fonts are currently not
@@ -18,32 +24,32 @@
class FontLoader {
public:
- // Load a font specified by |font_name| and |font_point_size| into a shared
- // memory buffer suitable for sending over IPC.
+ // Load a font specified by |font_to_encode| into a shared memory buffer
+ // suitable for sending over IPC.
//
// On return:
// returns true on success, false on failure.
// |font_data| - shared memory buffer containing the raw data for the font
// file.
// |font_data_size| - size of data contained in |font_data|.
- static bool LoadFontIntoBuffer(const string16& font_name,
- float font_point_size,
+ static bool LoadFontIntoBuffer(NSFont* font_to_encode,
base::SharedMemory* font_data,
uint32* font_data_size);
// Given a shared memory buffer containing the raw data for a font file, load
- // the font into a CGFontRef.
+ // the font and return a container ref.
//
// |data| - A shared memory handle pointing to the raw data from a font file.
// |data_size| - Size of |data|.
//
// On return:
// returns true on success, false on failure.
- // |font| - A CGFontRef containing the designated font, the caller is
- // responsible for releasing this value.
- static bool CreateCGFontFromBuffer(base::SharedMemoryHandle font_data,
- uint32 font_data_size,
- CGFontRef* font);
+ // |font_container| - A font container corresponding to the designated font.
+ // The caller is responsible for releasing this value via ATSFontDeactivate()
+ // when done
+ static bool ATSFontContainerFromBuffer(base::SharedMemoryHandle font_data,
+ uint32 font_data_size,
+ ATSFontContainerRef* font_container);
};
#endif // CHROME_COMMON_FONT_LOADER_MAC_H_