1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_H_
11 #include "base/memory/ref_counted.h"
12 #include "ppapi/proxy/serialized_structs.h"
16 class PepperTrueTypeFont
17 : public base::RefCountedThreadSafe<PepperTrueTypeFont> {
19 // Factory method to create a font for the current host.
20 static PepperTrueTypeFont* Create();
22 // Initializes the font. Updates the descriptor with the actual font's
23 // characteristics. The exact font will depend on the host platform's font
24 // matching and fallback algorithm. On failure, returns NULL and leaves desc
26 // NOTE: This method may perform long blocking file IO.
27 virtual int32_t Initialize(
28 ppapi::proxy::SerializedTrueTypeFontDesc* desc) = 0;
30 // Retrieves an array of TrueType table tags contained in this font. Returns
31 // the number of tags on success, a Pepper error code on failure. 'tags' are
32 // written only on success.
33 // NOTE: This method may perform long blocking file IO. It may be called even
34 // though the call to Initialize failed. Implementors must check validity.
35 virtual int32_t GetTableTags(std::vector<uint32_t>* tags) = 0;
37 // Gets a TrueType font table corresponding to the given tag. The 'offset' and
38 // 'max_data_length' parameters determine what part of the table is returned.
39 // Returns the data size in bytes on success, a Pepper error code on failure.
40 // 'data' is written only on success.
41 // NOTE: This method may perform long blocking file IO. It may be called even
42 // though the call to Initialize failed. Implementors must check validity.
43 virtual int32_t GetTable(uint32_t table_tag,
45 int32_t max_data_length,
46 std::string* data) = 0;
49 friend class base::RefCountedThreadSafe<PepperTrueTypeFont>;
50 virtual ~PepperTrueTypeFont() {};
53 } // namespace content
55 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TRUETYPE_FONT_H_