Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /***************************************************************************/ |
michael@0 | 2 | /* */ |
michael@0 | 3 | /* ftbdf.h */ |
michael@0 | 4 | /* */ |
michael@0 | 5 | /* FreeType API for accessing BDF-specific strings (specification). */ |
michael@0 | 6 | /* */ |
michael@0 | 7 | /* Copyright 2002-2004, 2006, 2009, 2014 by */ |
michael@0 | 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
michael@0 | 9 | /* */ |
michael@0 | 10 | /* This file is part of the FreeType project, and may only be used, */ |
michael@0 | 11 | /* modified, and distributed under the terms of the FreeType project */ |
michael@0 | 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
michael@0 | 13 | /* this file you indicate that you have read the license and */ |
michael@0 | 14 | /* understand and accept it fully. */ |
michael@0 | 15 | /* */ |
michael@0 | 16 | /***************************************************************************/ |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | #ifndef __FTBDF_H__ |
michael@0 | 20 | #define __FTBDF_H__ |
michael@0 | 21 | |
michael@0 | 22 | #include <ft2build.h> |
michael@0 | 23 | #include FT_FREETYPE_H |
michael@0 | 24 | |
michael@0 | 25 | #ifdef FREETYPE_H |
michael@0 | 26 | #error "freetype.h of FreeType 1 has been loaded!" |
michael@0 | 27 | #error "Please fix the directory search order for header files" |
michael@0 | 28 | #error "so that freetype.h of FreeType 2 is found first." |
michael@0 | 29 | #endif |
michael@0 | 30 | |
michael@0 | 31 | |
michael@0 | 32 | FT_BEGIN_HEADER |
michael@0 | 33 | |
michael@0 | 34 | |
michael@0 | 35 | /*************************************************************************/ |
michael@0 | 36 | /* */ |
michael@0 | 37 | /* <Section> */ |
michael@0 | 38 | /* bdf_fonts */ |
michael@0 | 39 | /* */ |
michael@0 | 40 | /* <Title> */ |
michael@0 | 41 | /* BDF and PCF Files */ |
michael@0 | 42 | /* */ |
michael@0 | 43 | /* <Abstract> */ |
michael@0 | 44 | /* BDF and PCF specific API. */ |
michael@0 | 45 | /* */ |
michael@0 | 46 | /* <Description> */ |
michael@0 | 47 | /* This section contains the declaration of functions specific to BDF */ |
michael@0 | 48 | /* and PCF fonts. */ |
michael@0 | 49 | /* */ |
michael@0 | 50 | /*************************************************************************/ |
michael@0 | 51 | |
michael@0 | 52 | |
michael@0 | 53 | /********************************************************************** |
michael@0 | 54 | * |
michael@0 | 55 | * @enum: |
michael@0 | 56 | * FT_PropertyType |
michael@0 | 57 | * |
michael@0 | 58 | * @description: |
michael@0 | 59 | * A list of BDF property types. |
michael@0 | 60 | * |
michael@0 | 61 | * @values: |
michael@0 | 62 | * BDF_PROPERTY_TYPE_NONE :: |
michael@0 | 63 | * Value~0 is used to indicate a missing property. |
michael@0 | 64 | * |
michael@0 | 65 | * BDF_PROPERTY_TYPE_ATOM :: |
michael@0 | 66 | * Property is a string atom. |
michael@0 | 67 | * |
michael@0 | 68 | * BDF_PROPERTY_TYPE_INTEGER :: |
michael@0 | 69 | * Property is a 32-bit signed integer. |
michael@0 | 70 | * |
michael@0 | 71 | * BDF_PROPERTY_TYPE_CARDINAL :: |
michael@0 | 72 | * Property is a 32-bit unsigned integer. |
michael@0 | 73 | */ |
michael@0 | 74 | typedef enum BDF_PropertyType_ |
michael@0 | 75 | { |
michael@0 | 76 | BDF_PROPERTY_TYPE_NONE = 0, |
michael@0 | 77 | BDF_PROPERTY_TYPE_ATOM = 1, |
michael@0 | 78 | BDF_PROPERTY_TYPE_INTEGER = 2, |
michael@0 | 79 | BDF_PROPERTY_TYPE_CARDINAL = 3 |
michael@0 | 80 | |
michael@0 | 81 | } BDF_PropertyType; |
michael@0 | 82 | |
michael@0 | 83 | |
michael@0 | 84 | /********************************************************************** |
michael@0 | 85 | * |
michael@0 | 86 | * @type: |
michael@0 | 87 | * BDF_Property |
michael@0 | 88 | * |
michael@0 | 89 | * @description: |
michael@0 | 90 | * A handle to a @BDF_PropertyRec structure to model a given |
michael@0 | 91 | * BDF/PCF property. |
michael@0 | 92 | */ |
michael@0 | 93 | typedef struct BDF_PropertyRec_* BDF_Property; |
michael@0 | 94 | |
michael@0 | 95 | |
michael@0 | 96 | /********************************************************************** |
michael@0 | 97 | * |
michael@0 | 98 | * @struct: |
michael@0 | 99 | * BDF_PropertyRec |
michael@0 | 100 | * |
michael@0 | 101 | * @description: |
michael@0 | 102 | * This structure models a given BDF/PCF property. |
michael@0 | 103 | * |
michael@0 | 104 | * @fields: |
michael@0 | 105 | * type :: |
michael@0 | 106 | * The property type. |
michael@0 | 107 | * |
michael@0 | 108 | * u.atom :: |
michael@0 | 109 | * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be |
michael@0 | 110 | * NULL, indicating an empty string. |
michael@0 | 111 | * |
michael@0 | 112 | * u.integer :: |
michael@0 | 113 | * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. |
michael@0 | 114 | * |
michael@0 | 115 | * u.cardinal :: |
michael@0 | 116 | * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. |
michael@0 | 117 | */ |
michael@0 | 118 | typedef struct BDF_PropertyRec_ |
michael@0 | 119 | { |
michael@0 | 120 | BDF_PropertyType type; |
michael@0 | 121 | union { |
michael@0 | 122 | const char* atom; |
michael@0 | 123 | FT_Int32 integer; |
michael@0 | 124 | FT_UInt32 cardinal; |
michael@0 | 125 | |
michael@0 | 126 | } u; |
michael@0 | 127 | |
michael@0 | 128 | } BDF_PropertyRec; |
michael@0 | 129 | |
michael@0 | 130 | |
michael@0 | 131 | /********************************************************************** |
michael@0 | 132 | * |
michael@0 | 133 | * @function: |
michael@0 | 134 | * FT_Get_BDF_Charset_ID |
michael@0 | 135 | * |
michael@0 | 136 | * @description: |
michael@0 | 137 | * Retrieve a BDF font character set identity, according to |
michael@0 | 138 | * the BDF specification. |
michael@0 | 139 | * |
michael@0 | 140 | * @input: |
michael@0 | 141 | * face :: |
michael@0 | 142 | * A handle to the input face. |
michael@0 | 143 | * |
michael@0 | 144 | * @output: |
michael@0 | 145 | * acharset_encoding :: |
michael@0 | 146 | * Charset encoding, as a C~string, owned by the face. |
michael@0 | 147 | * |
michael@0 | 148 | * acharset_registry :: |
michael@0 | 149 | * Charset registry, as a C~string, owned by the face. |
michael@0 | 150 | * |
michael@0 | 151 | * @return: |
michael@0 | 152 | * FreeType error code. 0~means success. |
michael@0 | 153 | * |
michael@0 | 154 | * @note: |
michael@0 | 155 | * This function only works with BDF faces, returning an error otherwise. |
michael@0 | 156 | */ |
michael@0 | 157 | FT_EXPORT( FT_Error ) |
michael@0 | 158 | FT_Get_BDF_Charset_ID( FT_Face face, |
michael@0 | 159 | const char* *acharset_encoding, |
michael@0 | 160 | const char* *acharset_registry ); |
michael@0 | 161 | |
michael@0 | 162 | |
michael@0 | 163 | /********************************************************************** |
michael@0 | 164 | * |
michael@0 | 165 | * @function: |
michael@0 | 166 | * FT_Get_BDF_Property |
michael@0 | 167 | * |
michael@0 | 168 | * @description: |
michael@0 | 169 | * Retrieve a BDF property from a BDF or PCF font file. |
michael@0 | 170 | * |
michael@0 | 171 | * @input: |
michael@0 | 172 | * face :: A handle to the input face. |
michael@0 | 173 | * |
michael@0 | 174 | * name :: The property name. |
michael@0 | 175 | * |
michael@0 | 176 | * @output: |
michael@0 | 177 | * aproperty :: The property. |
michael@0 | 178 | * |
michael@0 | 179 | * @return: |
michael@0 | 180 | * FreeType error code. 0~means success. |
michael@0 | 181 | * |
michael@0 | 182 | * @note: |
michael@0 | 183 | * This function works with BDF _and_ PCF fonts. It returns an error |
michael@0 | 184 | * otherwise. It also returns an error if the property is not in the |
michael@0 | 185 | * font. |
michael@0 | 186 | * |
michael@0 | 187 | * A `property' is a either key-value pair within the STARTPROPERTIES |
michael@0 | 188 | * ... ENDPROPERTIES block of a BDF font or a key-value pair from the |
michael@0 | 189 | * `info->props' array within a `FontRec' structure of a PCF font. |
michael@0 | 190 | * |
michael@0 | 191 | * Integer properties are always stored as `signed' within PCF fonts; |
michael@0 | 192 | * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value |
michael@0 | 193 | * for BDF fonts only. |
michael@0 | 194 | * |
michael@0 | 195 | * In case of error, `aproperty->type' is always set to |
michael@0 | 196 | * @BDF_PROPERTY_TYPE_NONE. |
michael@0 | 197 | */ |
michael@0 | 198 | FT_EXPORT( FT_Error ) |
michael@0 | 199 | FT_Get_BDF_Property( FT_Face face, |
michael@0 | 200 | const char* prop_name, |
michael@0 | 201 | BDF_PropertyRec *aproperty ); |
michael@0 | 202 | |
michael@0 | 203 | /* */ |
michael@0 | 204 | |
michael@0 | 205 | FT_END_HEADER |
michael@0 | 206 | |
michael@0 | 207 | #endif /* __FTBDF_H__ */ |
michael@0 | 208 | |
michael@0 | 209 | |
michael@0 | 210 | /* END */ |