Home | History | Annotate | Download | only in pepper
      1 // Copyright (c) 2013 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.
      4 
      5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_H_
      6 #define CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "ppapi/proxy/serialized_structs.h"
     12 
     13 namespace content {
     14 
     15 class PepperTrueTypeFont {
     16  public:
     17   // Creates a font matching the given descriptor. The exact font that is
     18   // returned will depend on the host platform's font matching and fallback
     19   // algorithm.
     20   static PepperTrueTypeFont* Create(
     21       const ppapi::proxy::SerializedTrueTypeFontDesc& desc);
     22   virtual ~PepperTrueTypeFont() {}
     23 
     24   // Returns true if the font was successfully created, false otherwise.
     25   virtual bool IsValid() = 0;
     26 
     27   // Returns a description of the actual font. Use this to see the actual
     28   // characteristics of the font after running the host platform's font matching
     29   // and fallback algorithm. Returns PP_OK on success, a Pepper error code on
     30   // failure. 'desc' is written only on success.
     31   virtual int32_t Describe(ppapi::proxy::SerializedTrueTypeFontDesc* desc) = 0;
     32 
     33   // Retrieves an array of TrueType table tags contained in this font. Returns
     34   // the number of tags on success, a Pepper error code on failure. 'tags' are
     35   // written only on success.
     36   virtual int32_t GetTableTags(std::vector<uint32_t>* tags) = 0;
     37 
     38   // Gets a TrueType font table corresponding to the given tag. The 'offset' and
     39   // 'max_data_length' parameters determine what part of the table is returned.
     40   // Returns the data size in bytes on success, a Pepper error code on failure.
     41   // 'data' is written only on success.
     42   virtual int32_t GetTable(uint32_t table_tag,
     43                            int32_t offset,
     44                            int32_t max_data_length,
     45                            std::string* data) = 0;
     46 };
     47 
     48 }  // namespace content
     49 
     50 #endif  // CONTENT_RENDERER_PEPPER_PEPPER_TRUETYPE_FONT_H_
     51