freetype.h 182 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866
  1. /***************************************************************************/
  2. /* */
  3. /* freetype.h */
  4. /* */
  5. /* FreeType high-level API and common types (specification only). */
  6. /* */
  7. /* Copyright 1996-2001, 2002 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  10. /* This file is part of the FreeType project, and may only be used, */
  11. /* modified, and distributed under the terms of the FreeType project */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #ifndef __FREETYPE_H__
  18. #define __FREETYPE_H__
  19. /*************************************************************************/
  20. /* */
  21. /* The `raster' component duplicates some of the declarations in */
  22. /* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */
  23. /* */
  24. /*************************************************************************/
  25. /* */
  26. /* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the */
  27. /* new FreeType design, which is able to host several kinds of font */
  28. /* drivers. It starts at 2.0. */
  29. /* */
  30. #define FREETYPE_MAJOR 2
  31. #define FREETYPE_MINOR 1
  32. #define FREETYPE_PATCH 4
  33. #include <ft2build.h>
  34. #include FT_CONFIG_CONFIG_H
  35. #include FT_ERRORS_H
  36. #include FT_TYPES_H
  37. FT_BEGIN_HEADER
  38. /*************************************************************************/
  39. /*************************************************************************/
  40. /* */
  41. /* B A S I C T Y P E S */
  42. /* */
  43. /*************************************************************************/
  44. /*************************************************************************/
  45. /*************************************************************************/
  46. /* */
  47. /* <Section> */
  48. /* base_interface */
  49. /* */
  50. /* <Title> */
  51. /* Base Interface */
  52. /* */
  53. /* <Abstract> */
  54. /* The FreeType 2 base font interface. */
  55. /* */
  56. /* <Description> */
  57. /* This section describes the public high-level API of FreeType 2. */
  58. /* */
  59. /* <Order> */
  60. /* FT_Library */
  61. /* FT_Face */
  62. /* FT_Size */
  63. /* FT_GlyphSlot */
  64. /* FT_CharMap */
  65. /* FT_Encoding */
  66. /* */
  67. /* FT_FaceRec */
  68. /* */
  69. /* FT_FACE_FLAG_SCALABLE */
  70. /* FT_FACE_FLAG_FIXED_SIZES */
  71. /* FT_FACE_FLAG_FIXED_WIDTH */
  72. /* FT_FACE_FLAG_HORIZONTAL */
  73. /* FT_FACE_FLAG_VERTICAL */
  74. /* FT_FACE_FLAG_SFNT */
  75. /* FT_FACE_FLAG_KERNING */
  76. /* FT_FACE_FLAG_MULTIPLE_MASTERS */
  77. /* FT_FACE_FLAG_GLYPH_NAMES */
  78. /* FT_FACE_FLAG_EXTERNAL_STREAM */
  79. /* FT_FACE_FLAG_FAST_GLYPHS */
  80. /* */
  81. /* FT_STYLE_FLAG_BOLD */
  82. /* FT_STYLE_FLAG_ITALIC */
  83. /* */
  84. /* FT_SizeRec */
  85. /* FT_Size_Metrics */
  86. /* */
  87. /* FT_GlyphSlotRec */
  88. /* FT_Glyph_Metrics */
  89. /* FT_SubGlyph */
  90. /* */
  91. /* FT_Bitmap_Size */
  92. /* */
  93. /* FT_Init_FreeType */
  94. /* FT_Done_FreeType */
  95. /* FT_Library_Version */
  96. /* */
  97. /* FT_New_Face */
  98. /* FT_Done_Face */
  99. /* FT_New_Memory_Face */
  100. /* FT_Open_Face */
  101. /* FT_Open_Args */
  102. /* FT_Open_Flags */
  103. /* FT_Parameter */
  104. /* FT_Attach_File */
  105. /* FT_Attach_Stream */
  106. /* */
  107. /* FT_Set_Char_Size */
  108. /* FT_Set_Pixel_Sizes */
  109. /* FT_Set_Transform */
  110. /* FT_Load_Glyph */
  111. /* FT_Get_Char_Index */
  112. /* FT_Get_Name_Index */
  113. /* FT_Load_Char */
  114. /* */
  115. /* FT_LOAD_DEFAULT */
  116. /* FT_LOAD_RENDER */
  117. /* FT_LOAD_MONOCHROME */
  118. /* FT_LOAD_LINEAR_DESIGN */
  119. /* FT_LOAD_NO_SCALE */
  120. /* FT_LOAD_NO_HINTING */
  121. /* FT_LOAD_NO_BITMAP */
  122. /* FT_LOAD_CROP_BITMAP */
  123. /* */
  124. /* FT_LOAD_VERTICAL_LAYOUT */
  125. /* FT_LOAD_IGNORE_TRANSFORM */
  126. /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
  127. /* FT_LOAD_FORCE_AUTOHINT */
  128. /* FT_LOAD_NO_RECURSE */
  129. /* FT_LOAD_PEDANTIC */
  130. /* */
  131. /* FT_Render_Glyph */
  132. /* FT_Render_Mode */
  133. /* FT_Get_Kerning */
  134. /* FT_Kerning_Mode */
  135. /* FT_Get_Glyph_Name */
  136. /* FT_Get_Postscript_Name */
  137. /* */
  138. /* FT_CharMapRec */
  139. /* FT_Select_Charmap */
  140. /* FT_Set_Charmap */
  141. /* */
  142. /*************************************************************************/
  143. /*************************************************************************/
  144. /* */
  145. /* <Struct> */
  146. /* FT_Glyph_Metrics */
  147. /* */
  148. /* <Description> */
  149. /* A structure used to model the metrics of a single glyph. Note */
  150. /* that values are expressed in 26.6 fractional pixel format or in */
  151. /* font units, depending on context. */
  152. /* */
  153. /* <Fields> */
  154. /* width :: The glyph's width. */
  155. /* */
  156. /* height :: The glyph's height. */
  157. /* */
  158. /* horiBearingX :: Horizontal left side bearing. */
  159. /* */
  160. /* horiBearingY :: Horizontal top side bearing. */
  161. /* */
  162. /* horiAdvance :: Horizontal advance width. */
  163. /* */
  164. /* vertBearingX :: Vertical left side bearing. */
  165. /* */
  166. /* vertBearingY :: Vertical top side bearing. */
  167. /* */
  168. /* vertAdvance :: Vertical advance height. */
  169. /* */
  170. typedef struct FT_Glyph_Metrics_
  171. {
  172. FT_Pos width; /* glyph width */
  173. FT_Pos height; /* glyph height */
  174. FT_Pos horiBearingX; /* left side bearing in horizontal layouts */
  175. FT_Pos horiBearingY; /* top side bearing in horizontal layouts */
  176. FT_Pos horiAdvance; /* advance width for horizontal layout */
  177. FT_Pos vertBearingX; /* left side bearing in vertical layouts */
  178. FT_Pos vertBearingY; /* top side bearing in vertical layouts */
  179. FT_Pos vertAdvance; /* advance height for vertical layout */
  180. } FT_Glyph_Metrics;
  181. /*************************************************************************/
  182. /* */
  183. /* <Struct> */
  184. /* FT_Bitmap_Size */
  185. /* */
  186. /* <Description> */
  187. /* An extremely simple structure used to model the size of a bitmap */
  188. /* strike (i.e., a bitmap instance of the font for a given */
  189. /* resolution) in a fixed-size font face. This is used for the */
  190. /* `available_sizes' field of the FT_Face_Properties structure. */
  191. /* */
  192. /* <Fields> */
  193. /* height :: The character height in pixels. */
  194. /* */
  195. /* width :: The character width in pixels. */
  196. /* */
  197. typedef struct FT_Bitmap_Size_
  198. {
  199. FT_Short height;
  200. FT_Short width;
  201. } FT_Bitmap_Size;
  202. /*************************************************************************/
  203. /*************************************************************************/
  204. /* */
  205. /* O B J E C T C L A S S E S */
  206. /* */
  207. /*************************************************************************/
  208. /*************************************************************************/
  209. /*************************************************************************/
  210. /* */
  211. /* <Type> */
  212. /* FT_Library */
  213. /* */
  214. /* <Description> */
  215. /* A handle to a FreeType library instance. Each `library' is */
  216. /* completely independent from the others; it is the `root' of a set */
  217. /* of objects like fonts, faces, sizes, etc. */
  218. /* */
  219. /* It also embeds a memory manager (see @FT_Memory), as well as a */
  220. /* scan-line converter object (see @FT_Raster). */
  221. /* */
  222. /* <Note> */
  223. /* Library objects are normally created by @FT_Init_FreeType, and */
  224. /* destroyed with @FT_Done_FreeType. */
  225. /* */
  226. typedef struct FT_LibraryRec_ *FT_Library;
  227. /*************************************************************************/
  228. /* */
  229. /* <Type> */
  230. /* FT_Module */
  231. /* */
  232. /* <Description> */
  233. /* A handle to a given FreeType module object. Each module can be a */
  234. /* font driver, a renderer, or anything else that provides services */
  235. /* to the formers. */
  236. /* */
  237. typedef struct FT_ModuleRec_* FT_Module;
  238. /*************************************************************************/
  239. /* */
  240. /* <Type> */
  241. /* FT_Driver */
  242. /* */
  243. /* <Description> */
  244. /* A handle to a given FreeType font driver object. Each font driver */
  245. /* is a special module capable of creating faces from font files. */
  246. /* */
  247. typedef struct FT_DriverRec_* FT_Driver;
  248. /*************************************************************************/
  249. /* */
  250. /* <Type> */
  251. /* FT_Renderer */
  252. /* */
  253. /* <Description> */
  254. /* A handle to a given FreeType renderer. A renderer is a special */
  255. /* module in charge of converting a glyph image to a bitmap, when */
  256. /* necessary. Each renderer supports a given glyph image format, and */
  257. /* one or more target surface depths. */
  258. /* */
  259. typedef struct FT_RendererRec_* FT_Renderer;
  260. /*************************************************************************/
  261. /* */
  262. /* <Type> */
  263. /* FT_Face */
  264. /* */
  265. /* <Description> */
  266. /* A handle to a given typographic face object. A face object models */
  267. /* a given typeface, in a given style. */
  268. /* */
  269. /* <Note> */
  270. /* Each face object also owns a single @FT_GlyphSlot object, as well */
  271. /* as one or more @FT_Size objects. */
  272. /* */
  273. /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
  274. /* a given filepathname or a custom input stream. */
  275. /* */
  276. /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
  277. /* */
  278. /* <Also> */
  279. /* The @FT_FaceRec details the publicly accessible fields of a given */
  280. /* face object. */
  281. /* */
  282. typedef struct FT_FaceRec_* FT_Face;
  283. /*************************************************************************/
  284. /* */
  285. /* <Type> */
  286. /* FT_Size */
  287. /* */
  288. /* <Description> */
  289. /* A handle to a given size object. Such an object models the data */
  290. /* that depends on the current _resolution_ and _character size_ in a */
  291. /* given @FT_Face. */
  292. /* */
  293. /* <Note> */
  294. /* Each face object owns one or more sizes. There is however a */
  295. /* single _active_ size for the face at any time that will be used by */
  296. /* functions like @FT_Load_Glyph, @FT_Get_Kerning, etc. */
  297. /* */
  298. /* You can use the @FT_Activate_Size API to change the current */
  299. /* active size of any given face. */
  300. /* */
  301. /* <Also> */
  302. /* The @FT_SizeRec structure details the publicly accessible fields */
  303. /* of a given face object. */
  304. /* */
  305. typedef struct FT_SizeRec_* FT_Size;
  306. /*************************************************************************/
  307. /* */
  308. /* <Type> */
  309. /* FT_GlyphSlot */
  310. /* */
  311. /* <Description> */
  312. /* A handle to a given `glyph slot'. A slot is a container where it */
  313. /* is possible to load any one of the glyphs contained in its parent */
  314. /* face. */
  315. /* */
  316. /* In other words, each time you call @FT_Load_Glyph or */
  317. /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
  318. /* i.e. the glyph's metrics, its image (bitmap or outline), and */
  319. /* other control information. */
  320. /* */
  321. /* <Also> */
  322. /* @FT_GlyphSlotRec details the publicly accessible glyph fields. */
  323. /* */
  324. typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
  325. /*************************************************************************/
  326. /* */
  327. /* <Type> */
  328. /* FT_CharMap */
  329. /* */
  330. /* <Description> */
  331. /* A handle to a given character map. A charmap is used to translate */
  332. /* character codes in a given encoding into glyph indexes for its */
  333. /* parent's face. Some font formats may provide several charmaps per */
  334. /* font. */
  335. /* */
  336. /* Each face object owns zero or more charmaps, but only one of them */
  337. /* can be "active" and used by @FT_Get_Char_Index or @FT_Load_Char. */
  338. /* */
  339. /* The list of available charmaps in a face is available through the */
  340. /* "face->num_charmaps" and "face->charmaps" fields of @FT_FaceRec. */
  341. /* */
  342. /* The currently active charmap is available as "face->charmap". */
  343. /* You should call @FT_Set_Charmap to change it. */
  344. /* */
  345. /* <Note> */
  346. /* When a new face is created (either through @FT_New_Face or */
  347. /* @FT_Open_Face), the library looks for a Unicode charmap within */
  348. /* the list and automatically activates it. */
  349. /* */
  350. typedef struct FT_CharMapRec_* FT_CharMap;
  351. /*************************************************************************/
  352. /* */
  353. /* <Macro> */
  354. /* FT_ENC_TAG */
  355. /* */
  356. /* <Description> */
  357. /* This macro converts four letter tags into an unsigned long. It is */
  358. /* used to define "encoding" identifiers (see @FT_Encoding). */
  359. /* */
  360. /* <Note> */
  361. /* Since many 16bit compilers don't like 32bit enumerations, you */
  362. /* should redefine this macro in case of problems to something like */
  363. /* this: */
  364. /* */
  365. /* #define FT_ENC_TAG( value, a, b, c, d ) (value) */
  366. /* */
  367. /* to get a simple enumeration without assigning special numbers. */
  368. /* */
  369. #ifndef FT_ENC_TAG
  370. #define FT_ENC_TAG( value, a, b, c, d ) \
  371. value = ( ( (FT_UInt32)(a) << 24 ) | \
  372. ( (FT_UInt32)(b) << 16 ) | \
  373. ( (FT_UInt32)(c) << 8 ) | \
  374. (FT_UInt32)(d) )
  375. #endif /* FT_ENC_TAG */
  376. /*************************************************************************/
  377. /* */
  378. /* <Enum> */
  379. /* FT_Encoding */
  380. /* */
  381. /* <Description> */
  382. /* An enumeration used to specify encodings supported by charmaps. */
  383. /* Used in the @FT_Select_Charmap API function. */
  384. /* */
  385. /* <Note> */
  386. /* Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */
  387. /* all character codes must be expressed as FT_Longs. */
  388. /* */
  389. /* The values of this type correspond to specific character */
  390. /* repertories (i.e. charsets), and not to text encoding methods */
  391. /* (like UTF-8, UTF-16, GB2312_EUC, etc.). */
  392. /* */
  393. /* Other encodings might be defined in the future. */
  394. /* */
  395. /* <Values> */
  396. /* FT_ENCODING_NONE :: */
  397. /* The encoding value 0 is reserved. */
  398. /* */
  399. /* FT_ENCODING_UNICODE :: */
  400. /* Corresponds to the Unicode character set. This value covers */
  401. /* all versions of the Unicode repertoire, including ASCII and */
  402. /* Latin-1. Most fonts include a Unicode charmap, but not all */
  403. /* of them. */
  404. /* */
  405. /* FT_ENCODING_MS_SYMBOL :: */
  406. /* Corresponds to the Microsoft Symbol encoding, used to encode */
  407. /* mathematical symbols in the 32..255 character code range. For */
  408. /* more information, see `http://www.ceviz.net/symbol.htm'. */
  409. /* */
  410. /* FT_ENCODING_MS_SJIS :: */
  411. /* Corresponds to Microsoft's Japanese SJIS encoding. More info */
  412. /* at `http://langsupport.japanreference.com/encoding.shtml'. */
  413. /* See note on multi-byte encodings below. */
  414. /* */
  415. /* FT_ENCODING_MS_GB2312 :: */
  416. /* Corresponds to the encoding system for Simplified Chinese, as */
  417. /* used in China. Only found in some TrueType fonts. */
  418. /* */
  419. /* FT_ENCODING_MS_BIG5 :: */
  420. /* Corresponds to the encoding system for Traditional Chinese, as */
  421. /* used in Taiwan and Hong Kong. Only found in some TrueType fonts. */
  422. /* */
  423. /* FT_ENCODING_MS_WANSUNG :: */
  424. /* Corresponds to the Korean encoding system known as Wansung. */
  425. /* This is a Microsoft encoding that is only found in some TrueType */
  426. /* fonts. For more information, see */
  427. /* `http://www.microsoft.com/typography/unicode/949.txt'. */
  428. /* */
  429. /* FT_ENCODING_MS_JOHAB :: */
  430. /* The Korean standard character set (KS C-5601-1992), which */
  431. /* corresponds to Windows code page 1361. This character set */
  432. /* includes all possible Hangeul character combinations. */
  433. /* Only found on some rare TrueType fonts. */
  434. /* */
  435. /* FT_ENCODING_ADOBE_LATIN_1 :: */
  436. /* Corresponds to a Latin-1 encoding as defined in a Type 1 */
  437. /* Postscript font. It is limited to 256 character codes. */
  438. /* */
  439. /* FT_ENCODING_ADOBE_STANDARD :: */
  440. /* Corresponds to the Adobe Standard encoding, as found in Type 1, */
  441. /* CFF, and OpenType/CFF fonts. It is limited to 256character */
  442. /* codes. */
  443. /* */
  444. /* FT_ENCODING_ADOBE_EXPERT :: */
  445. /* Corresponds to the Adobe Expert encoding, as found in Type 1, */
  446. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  447. /* codes. */
  448. /* */
  449. /* FT_ENCODING_ADOBE_CUSTOM :: */
  450. /* Corresponds to a custom encoding, as found in Type 1, CFF, and */
  451. /* OpenType/CFF fonts. It is limited to 256 character codes. */
  452. /* */
  453. /* FT_ENCODING_APPLE_ROMAN :: */
  454. /* Corresponds to the 8-bit Apple roman encoding. Many TrueType and */
  455. /* OpenType fonts contain a charmap for this encoding, since older */
  456. /* versions of Mac OS are able to use it. */
  457. /* */
  458. /* FT_ENCODING_OLD_LATIN_2 :: */
  459. /* This value is deprecated and was never used nor reported by */
  460. /* FreeType. Don't use or test for it. */
  461. /* */
  462. /* <Note> */
  463. /* By default, FreeType automatically synthetizes a Unicode charmap */
  464. /* for Postscript fonts, using their glyph names dictionaries. */
  465. /* However, it will also report the encodings defined explicitly in */
  466. /* the font file, for the cases when they are needed, with the Adobe */
  467. /* values as well. */
  468. /* */
  469. typedef enum FT_Encoding_
  470. {
  471. FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
  472. FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
  473. FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
  474. FT_ENC_TAG( FT_ENCODING_MS_SJIS, 's', 'j', 'i', 's' ),
  475. FT_ENC_TAG( FT_ENCODING_MS_GB2312, 'g', 'b', ' ', ' ' ),
  476. FT_ENC_TAG( FT_ENCODING_MS_BIG5, 'b', 'i', 'g', '5' ),
  477. FT_ENC_TAG( FT_ENCODING_MS_WANSUNG, 'w', 'a', 'n', 's' ),
  478. FT_ENC_TAG( FT_ENCODING_MS_JOHAB, 'j', 'o', 'h', 'a' ),
  479. FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
  480. FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
  481. FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
  482. FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
  483. FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
  484. FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
  485. } FT_Encoding;
  486. /*************************************************************************/
  487. /* */
  488. /* <Enum> */
  489. /* ft_encoding_xxx */
  490. /* */
  491. /* <Description> */
  492. /* These constants are deprecated; use the corresponding @FT_Encoding */
  493. /* values instead. */
  494. /* */
  495. /* <Values> */
  496. /* ft_encoding_none :: see @FT_ENCODING_NONE */
  497. /* ft_encoding_unicode :: see @FT_ENCODING_UNICODE */
  498. /* ft_encoding_latin_2 :: see @FT_ENCODING_OLD_LATIN_2 */
  499. /* ft_encoding_symbol :: see @FT_ENCODING_MS_SYMBOL */
  500. /* ft_encoding_sjis :: see @FT_ENCODING_MS_SJIS */
  501. /* ft_encoding_gb2312 :: see @FT_ENCODING_MS_GB2312 */
  502. /* ft_encoding_big5 :: see @FT_ENCODING_MS_BIG5 */
  503. /* ft_encoding_wansung :: see @FT_ENCODING_MS_WANSUNG */
  504. /* ft_encoding_johab :: see @FT_ENCODING_MS_JOHAB */
  505. /* */
  506. /* ft_encoding_adobe_standard :: see @FT_ENCODING_ADOBE_STANDARD */
  507. /* ft_encoding_adobe_expert :: see @FT_ENCODING_ADOBE_EXPERT */
  508. /* ft_encoding_adobe_custom :: see @FT_ENCODING_ADOBE_CUSTOM */
  509. /* ft_encoding_latin_1 :: see @FT_ENCODING_ADOBE_LATIN_1 */
  510. /* */
  511. /* ft_encoding_apple_roman :: see @FT_ENCODING_APPLE_ROMAN */
  512. /* */
  513. #define ft_encoding_none FT_ENCODING_NONE
  514. #define ft_encoding_unicode FT_ENCODING_UNICODE
  515. #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
  516. #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
  517. #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
  518. #define ft_encoding_sjis FT_ENCODING_MS_SJIS
  519. #define ft_encoding_gb2312 FT_ENCODING_MS_GB2312
  520. #define ft_encoding_big5 FT_ENCODING_MS_BIG5
  521. #define ft_encoding_wansung FT_ENCODING_MS_WANSUNG
  522. #define ft_encoding_johab FT_ENCODING_MS_JOHAB
  523. #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
  524. #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
  525. #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
  526. #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
  527. /*************************************************************************/
  528. /* */
  529. /* <Struct> */
  530. /* FT_CharMapRec */
  531. /* */
  532. /* <Description> */
  533. /* The base charmap structure. */
  534. /* */
  535. /* <Fields> */
  536. /* face :: A handle to the parent face object. */
  537. /* */
  538. /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
  539. /* this with @FT_Select_Charmap. */
  540. /* */
  541. /* platform_id :: An ID number describing the platform for the */
  542. /* following encoding ID. This comes directly from */
  543. /* the TrueType specification and should be emulated */
  544. /* for other formats. */
  545. /* */
  546. /* encoding_id :: A platform specific encoding number. This also */
  547. /* comes from the TrueType specification and should be */
  548. /* emulated similarly. */
  549. /* */
  550. typedef struct FT_CharMapRec_
  551. {
  552. FT_Face face;
  553. FT_Encoding encoding;
  554. FT_UShort platform_id;
  555. FT_UShort encoding_id;
  556. } FT_CharMapRec;
  557. /*************************************************************************/
  558. /*************************************************************************/
  559. /* */
  560. /* B A S E O B J E C T C L A S S E S */
  561. /* */
  562. /*************************************************************************/
  563. /*************************************************************************/
  564. /*************************************************************************/
  565. /* */
  566. /* <Type> */
  567. /* FT_Face_Internal */
  568. /* */
  569. /* <Description> */
  570. /* An opaque handle to an FT_Face_InternalRec structure, used to */
  571. /* model private data of a given @FT_Face object. */
  572. /* */
  573. /* This structure might change between releases of FreeType 2 and is */
  574. /* not generally available to client applications. */
  575. /* */
  576. typedef struct FT_Face_InternalRec_* FT_Face_Internal;
  577. /*************************************************************************/
  578. /* */
  579. /* <Struct> */
  580. /* FT_FaceRec */
  581. /* */
  582. /* <Description> */
  583. /* FreeType root face class structure. A face object models the */
  584. /* resolution and point-size independent data found in a font file. */
  585. /* */
  586. /* <Fields> */
  587. /* num_faces :: In the case where the face is located in a */
  588. /* collection (i.e., a file which embeds */
  589. /* several faces), this is the total number of */
  590. /* faces found in the resource. 1 by default. */
  591. /* */
  592. /* face_index :: The index of the face in its font file. */
  593. /* Usually, this is 0 for all normal font */
  594. /* formats. It can be more in the case of */
  595. /* collections (which embed several fonts in a */
  596. /* single resource/file). */
  597. /* */
  598. /* face_flags :: A set of bit flags that give important */
  599. /* information about the face; see the */
  600. /* @FT_FACE_FLAG_XXX constants for details. */
  601. /* */
  602. /* style_flags :: A set of bit flags indicating the style of */
  603. /* the face (i.e., italic, bold, underline, */
  604. /* etc). See the @FT_STYLE_FLAG_XXX */
  605. /* constants. */
  606. /* */
  607. /* num_glyphs :: The total number of glyphs in the face. */
  608. /* */
  609. /* family_name :: The face's family name. This is an ASCII */
  610. /* string, usually in English, which describes */
  611. /* the typeface's family (like `Times New */
  612. /* Roman', `Bodoni', `Garamond', etc). This */
  613. /* is a least common denominator used to list */
  614. /* fonts. Some formats (TrueType & OpenType) */
  615. /* provide localized and Unicode versions of */
  616. /* this string. Applications should use the */
  617. /* format specific interface to access them. */
  618. /* */
  619. /* style_name :: The face's style name. This is an ASCII */
  620. /* string, usually in English, which describes */
  621. /* the typeface's style (like `Italic', */
  622. /* `Bold', `Condensed', etc). Not all font */
  623. /* formats provide a style name, so this field */
  624. /* is optional, and can be set to NULL. As */
  625. /* for `family_name', some formats provide */
  626. /* localized/Unicode versions of this string. */
  627. /* Applications should use the format specific */
  628. /* interface to access them. */
  629. /* */
  630. /* num_fixed_sizes :: The number of fixed sizes available in this */
  631. /* face. This should be set to 0 for scalable */
  632. /* fonts, unless its face includes a complete */
  633. /* set of glyphs (called a `strike') for the */
  634. /* specified sizes. */
  635. /* */
  636. /* available_sizes :: An array of sizes specifying the available */
  637. /* bitmap/graymap sizes that are contained in */
  638. /* in the font face. Should be set to NULL if */
  639. /* the field `num_fixed_sizes' is set to 0. */
  640. /* */
  641. /* num_charmaps :: The total number of character maps in the */
  642. /* face. */
  643. /* */
  644. /* charmaps :: A table of pointers to the face's charmaps. */
  645. /* Used to scan the list of available charmaps */
  646. /* -- this table might change after a call to */
  647. /* @FT_Attach_File or @FT_Attach_Stream (e.g. */
  648. /* if used to hook an additional encoding or */
  649. /* CMap to the face object). */
  650. /* */
  651. /* generic :: A field reserved for client uses. See the */
  652. /* @FT_Generic type description. */
  653. /* */
  654. /* bbox :: The font bounding box. Coordinates are */
  655. /* expressed in font units (see units_per_EM). */
  656. /* The box is large enough to contain any */
  657. /* glyph from the font. Thus, bbox.yMax can */
  658. /* be seen as the `maximal ascender', */
  659. /* bbox.yMin as the `minimal descender', and */
  660. /* the maximal glyph width is given by */
  661. /* `bbox.xMax-bbox.xMin' (not to be confused */
  662. /* with the maximal _advance_width_). Only */
  663. /* relevant for scalable formats. */
  664. /* */
  665. /* units_per_EM :: The number of font units per EM square for */
  666. /* this face. This is typically 2048 for */
  667. /* TrueType fonts, 1000 for Type1 fonts, and */
  668. /* should be set to the (unrealistic) value 1 */
  669. /* for fixed-sizes fonts. Only relevant for */
  670. /* scalable formats. */
  671. /* */
  672. /* ascender :: The face's ascender is the vertical */
  673. /* distance from the baseline to the topmost */
  674. /* point of any glyph in the face. This */
  675. /* field's value is positive, expressed in */
  676. /* font units. Some font designs use a value */
  677. /* different from `bbox.yMax'. Only relevant */
  678. /* for scalable formats. */
  679. /* */
  680. /* descender :: The face's descender is the vertical */
  681. /* distance from the baseline to the */
  682. /* bottommost point of any glyph in the face. */
  683. /* This field's value is *negative*, expressed */
  684. /* in font units. Some font designs use a */
  685. /* value different from `bbox.yMin'. Only */
  686. /* relevant for scalable formats. */
  687. /* */
  688. /* height :: The face's height is the vertical distance */
  689. /* from one baseline to the next when writing */
  690. /* several lines of text. Its value is always */
  691. /* positive, expressed in font units. The */
  692. /* value can be computed as */
  693. /* `ascender+descender+line_gap' where the */
  694. /* value of `line_gap' is also called */
  695. /* `external leading'. Only relevant for */
  696. /* scalable formats. */
  697. /* */
  698. /* max_advance_width :: The maximal advance width, in font units, */
  699. /* for all glyphs in this face. This can be */
  700. /* used to make word wrapping computations */
  701. /* faster. Only relevant for scalable */
  702. /* formats. */
  703. /* */
  704. /* max_advance_height :: The maximal advance height, in font units, */
  705. /* for all glyphs in this face. This is only */
  706. /* relevant for vertical layouts, and should */
  707. /* be set to the `height' for fonts that do */
  708. /* not provide vertical metrics. Only */
  709. /* relevant for scalable formats. */
  710. /* */
  711. /* underline_position :: The position, in font units, of the */
  712. /* underline line for this face. It's the */
  713. /* center of the underlining stem. Only */
  714. /* relevant for scalable formats. */
  715. /* */
  716. /* underline_thickness :: The thickness, in font units, of the */
  717. /* underline for this face. Only relevant for */
  718. /* scalable formats. */
  719. /* */
  720. /* glyph :: The face's associated glyph slot(s). This */
  721. /* object is created automatically with a new */
  722. /* face object. However, certain kinds of */
  723. /* applications (mainly tools like converters) */
  724. /* can need more than one slot to ease their */
  725. /* task. */
  726. /* */
  727. /* size :: The current active size for this face. */
  728. /* */
  729. /* charmap :: The current active charmap for this face. */
  730. /* */
  731. typedef struct FT_FaceRec_
  732. {
  733. FT_Long num_faces;
  734. FT_Long face_index;
  735. FT_Long face_flags;
  736. FT_Long style_flags;
  737. FT_Long num_glyphs;
  738. FT_String* family_name;
  739. FT_String* style_name;
  740. FT_Int num_fixed_sizes;
  741. FT_Bitmap_Size* available_sizes;
  742. FT_Int num_charmaps;
  743. FT_CharMap* charmaps;
  744. FT_Generic generic;
  745. /*# the following are only relevant to scalable outlines */
  746. FT_BBox bbox;
  747. FT_UShort units_per_EM;
  748. FT_Short ascender;
  749. FT_Short descender;
  750. FT_Short height;
  751. FT_Short max_advance_width;
  752. FT_Short max_advance_height;
  753. FT_Short underline_position;
  754. FT_Short underline_thickness;
  755. FT_GlyphSlot glyph;
  756. FT_Size size;
  757. FT_CharMap charmap;
  758. /*@private begin */
  759. FT_Driver driver;
  760. FT_Memory memory;
  761. FT_Stream stream;
  762. FT_ListRec sizes_list;
  763. FT_Generic autohint;
  764. void* extensions;
  765. FT_Face_Internal internal;
  766. /*@private end */
  767. } FT_FaceRec;
  768. /*************************************************************************/
  769. /* */
  770. /* <Enum> */
  771. /* FT_FACE_FLAG_XXX */
  772. /* */
  773. /* <Description> */
  774. /* A list of bit flags used in the 'face_flags' field of the */
  775. /* @FT_FaceRec structure. They inform client applications of */
  776. /* properties of the corresponding face. */
  777. /* */
  778. /* <Values> */
  779. /* FT_FACE_FLAG_SCALABLE :: */
  780. /* Indicates that the face provides vectorial outlines. This */
  781. /* doesn't prevent embedded bitmaps, i.e., a face can have both */
  782. /* this bit and @FT_FACE_FLAG_FIXED_SIZES set */
  783. /* */
  784. /* FT_FACE_FLAG_FIXED_SIZES :: */
  785. /* Indicates that the face contains `fixed sizes', i.e., bitmap */
  786. /* strikes for some given pixel sizes. See the `num_fixed_sizes' */
  787. /* and `available_sizes' fields of @FT_FaceRec. */
  788. /* */
  789. /* FT_FACE_FLAG_FIXED_WIDTH :: */
  790. /* Indicates that the face contains fixed-width characters (like */
  791. /* Courier, Lucido, MonoType, etc.). */
  792. /* */
  793. /* FT_FACE_FLAG_SFNT :: */
  794. /* Indicates that the face uses the `sfnt' storage scheme. For */
  795. /* now, this means TrueType and OpenType. */
  796. /* */
  797. /* FT_FACE_FLAG_HORIZONTAL :: */
  798. /* Indicates that the face contains horizontal glyph metrics. This */
  799. /* should be set for all common formats. */
  800. /* */
  801. /* FT_FACE_FLAG_VERTICAL :: */
  802. /* Indicates that the face contains vertical glyph metrics. This */
  803. /* is only available in some formats, not all of them. */
  804. /* */
  805. /* FT_FACE_FLAG_KERNING :: */
  806. /* Indicates that the face contains kerning information. If set, */
  807. /* the kerning distance can be retrieved through the function */
  808. /* @FT_Get_Kerning. Note that if unset, this function will always */
  809. /* return the vector (0,0). */
  810. /* */
  811. /* FT_FACE_FLAG_FAST_GLYPHS :: */
  812. /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
  813. /* */
  814. /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
  815. /* Indicates that the font contains multiple masters and is capable */
  816. /* of interpolating between them. See the multiple-masters */
  817. /* specific API for details. */
  818. /* */
  819. /* FT_FACE_FLAG_GLYPH_NAMES :: */
  820. /* Indicates that the font contains glyph names that can be */
  821. /* retrieved through @FT_Get_Glyph_Names. Note that some TrueType */
  822. /* fonts contain broken glyph name tables. Use the function */
  823. /* @FT_Has_PS_Glyph_Name when needed. */
  824. /* */
  825. /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
  826. /* Used internally by FreeType to indicate that a face's stream was */
  827. /* provided by the client application and should not be destroyed */
  828. /* when @FT_Done_Face is called. Don't read or test this flag. */
  829. /* */
  830. #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
  831. #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
  832. #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
  833. #define FT_FACE_FLAG_SFNT ( 1L << 3 )
  834. #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
  835. #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
  836. #define FT_FACE_FLAG_KERNING ( 1L << 6 )
  837. #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
  838. #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
  839. #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
  840. #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
  841. /* */
  842. /*************************************************************************/
  843. /* */
  844. /* @macro: */
  845. /* FT_HAS_HORIZONTAL( face ) */
  846. /* */
  847. /* @description: */
  848. /* A macro that returns true whenever a face object contains */
  849. /* horizontal metrics (this is true for all font formats though). */
  850. /* */
  851. /* @also: */
  852. /* @FT_HAS_VERTICAL can be used to check for vertical metrics. */
  853. /* */
  854. #define FT_HAS_HORIZONTAL( face ) \
  855. ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
  856. /*************************************************************************/
  857. /* */
  858. /* @macro: */
  859. /* FT_HAS_VERTICAL( face ) */
  860. /* */
  861. /* @description: */
  862. /* A macro that returns true whenever a face object contains vertical */
  863. /* metrics. */
  864. /* */
  865. #define FT_HAS_VERTICAL( face ) \
  866. ( face->face_flags & FT_FACE_FLAG_VERTICAL )
  867. /*************************************************************************/
  868. /* */
  869. /* @macro: */
  870. /* FT_HAS_KERNING( face ) */
  871. /* */
  872. /* @description: */
  873. /* A macro that returns true whenever a face object contains kerning */
  874. /* data that can be accessed with @FT_Get_Kerning. */
  875. /* */
  876. #define FT_HAS_KERNING( face ) \
  877. ( face->face_flags & FT_FACE_FLAG_KERNING )
  878. /*************************************************************************/
  879. /* */
  880. /* @macro: */
  881. /* FT_IS_SCALABLE( face ) */
  882. /* */
  883. /* @description: */
  884. /* A macro that returns true whenever a face object contains a */
  885. /* scalable font face (true for TrueType, Type 1, CID, and */
  886. /* OpenType/CFF font formats. */
  887. /* */
  888. #define FT_IS_SCALABLE( face ) \
  889. ( face->face_flags & FT_FACE_FLAG_SCALABLE )
  890. /*************************************************************************/
  891. /* */
  892. /* @macro: */
  893. /* FT_IS_SFNT( face ) */
  894. /* */
  895. /* @description: */
  896. /* A macro that returns true whenever a face object contains a font */
  897. /* whose format is based on the SFNT storage scheme. This usually */
  898. /* means: TrueType fonts, OpenType fonts, as well as SFNT-based */
  899. /* embedded bitmap fonts. */
  900. /* */
  901. /* If this macro is true, all functions defined in @FT_SFNT_NAMES_H */
  902. /* and @FT_TRUETYPE_TABLES_H are available. */
  903. /* */
  904. #define FT_IS_SFNT( face ) \
  905. ( face->face_flags & FT_FACE_FLAG_SFNT )
  906. /*************************************************************************/
  907. /* */
  908. /* @macro: */
  909. /* FT_IS_FIXED_WIDTH( face ) */
  910. /* */
  911. /* @description: */
  912. /* A macro that returns true whenever a face object contains a font */
  913. /* face that contains fixed-width (or "monospace", "fixed-pitch", */
  914. /* etc.) glyphs. */
  915. /* */
  916. #define FT_IS_FIXED_WIDTH( face ) \
  917. ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
  918. /*************************************************************************/
  919. /* */
  920. /* @macro: */
  921. /* FT_IS_FIXED_SIZES( face ) */
  922. /* */
  923. /* @description: */
  924. /* A macro that returns true whenever a face object contains some */
  925. /* embedded bitmaps. See the `fixed_sizes' field of the @FT_FaceRec */
  926. /* structure. */
  927. /* */
  928. #define FT_HAS_FIXED_SIZES( face ) \
  929. ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
  930. /* */
  931. /*************************************************************************/
  932. /* */
  933. /* @macro: */
  934. /* FT_HAS_FAST_GLYPHS( face ) */
  935. /* */
  936. /* @description: */
  937. /* Deprecated; indicates that the face contains so-called "fast" */
  938. /* glyph bitmaps. */
  939. /* */
  940. #define FT_HAS_FAST_GLYPHS( face ) \
  941. ( face->face_flags & FT_FACE_FLAG_FAST_GLYPHS )
  942. /*************************************************************************/
  943. /* */
  944. /* @macro: */
  945. /* FT_HAS_GLYPH_NAMES( face ) */
  946. /* */
  947. /* @description: */
  948. /* A macro that returns true whenever a face object contains some */
  949. /* glyph names that can be accessed through @FT_Get_Glyph_Names. */
  950. /* */
  951. #define FT_HAS_GLYPH_NAMES( face ) \
  952. ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
  953. /*************************************************************************/
  954. /* */
  955. /* @macro: */
  956. /* FT_HAS_MULTIPLE_MASTERS( face ) */
  957. /* */
  958. /* @description: */
  959. /* A macro that returns true whenever a face object contains some */
  960. /* multiple masters. The functions provided by */
  961. /* @FT_MULTIPLE_MASTERS_H are then available to choose the exact */
  962. /* design you want. */
  963. /* */
  964. #define FT_HAS_MULTIPLE_MASTERS( face ) \
  965. ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
  966. /*************************************************************************/
  967. /* */
  968. /* <Constant> */
  969. /* FT_STYLE_FLAG_XXX */
  970. /* */
  971. /* <Description> */
  972. /* A list of bit-flags used to indicate the style of a given face. */
  973. /* These are used in the `style_flags' field of @FT_FaceRec. */
  974. /* */
  975. /* <Values> */
  976. /* FT_STYLE_FLAG_ITALIC :: */
  977. /* Indicates that a given face is italicized. */
  978. /* */
  979. /* FT_STYLE_FLAG_BOLD :: */
  980. /* Indicates that a given face is bold. */
  981. /* */
  982. #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
  983. #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
  984. /*************************************************************************/
  985. /* */
  986. /* <Type> */
  987. /* FT_Size_Internal */
  988. /* */
  989. /* <Description> */
  990. /* An opaque handle to an FT_Size_InternalRec structure, used to */
  991. /* model private data of a given FT_Size object. */
  992. /* */
  993. typedef struct FT_Size_InternalRec_* FT_Size_Internal;
  994. /*************************************************************************/
  995. /* */
  996. /* <Struct> */
  997. /* FT_Size_Metrics */
  998. /* */
  999. /* <Description> */
  1000. /* The size metrics structure returned scaled important distances for */
  1001. /* a given size object. */
  1002. /* */
  1003. /* <Fields> */
  1004. /* x_ppem :: The character width, expressed in integer pixels. */
  1005. /* This is the width of the EM square expressed in */
  1006. /* pixels, hence the term `ppem' (pixels per EM). */
  1007. /* */
  1008. /* y_ppem :: The character height, expressed in integer pixels. */
  1009. /* This is the height of the EM square expressed in */
  1010. /* pixels, hence the term `ppem' (pixels per EM). */
  1011. /* */
  1012. /* x_scale :: A simple 16.16 fixed point format coefficient used */
  1013. /* to scale horizontal distances expressed in font */
  1014. /* units to fractional (26.6) pixel coordinates. */
  1015. /* */
  1016. /* y_scale :: A simple 16.16 fixed point format coefficient used */
  1017. /* to scale vertical distances expressed in font */
  1018. /* units to fractional (26.6) pixel coordinates. */
  1019. /* */
  1020. /* ascender :: The ascender, expressed in 26.6 fixed point */
  1021. /* pixels. Always positive. */
  1022. /* */
  1023. /* descender :: The descender, expressed in 26.6 fixed point */
  1024. /* pixels. Always negative. */
  1025. /* */
  1026. /* height :: The text height, expressed in 26.6 fixed point */
  1027. /* pixels. Always positive. */
  1028. /* */
  1029. /* max_advance :: Maximum horizontal advance, expressed in 26.6 */
  1030. /* fixed point pixels. Always positive. */
  1031. /* */
  1032. /* <Note> */
  1033. /* The values of `ascender', `descender', and `height' are only the */
  1034. /* scaled versions of `face->ascender', `face->descender', and */
  1035. /* `face->height'. */
  1036. /* */
  1037. /* Unfortunately, due to glyph hinting, these values might not be */
  1038. /* exact for certain fonts, they thus must be treated as unreliable */
  1039. /* with an error margin of at least one pixel! */
  1040. /* */
  1041. /* Indeed, the only way to get the exact pixel ascender and descender */
  1042. /* is to render _all_ glyphs. As this would be a definite */
  1043. /* performance hit, it is up to client applications to perform such */
  1044. /* computations. */
  1045. /* */
  1046. typedef struct FT_Size_Metrics_
  1047. {
  1048. FT_UShort x_ppem; /* horizontal pixels per EM */
  1049. FT_UShort y_ppem; /* vertical pixels per EM */
  1050. FT_Fixed x_scale; /* two scales used to convert font units */
  1051. FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates.. */
  1052. FT_Pos ascender; /* ascender in 26.6 frac. pixels */
  1053. FT_Pos descender; /* descender in 26.6 frac. pixels */
  1054. FT_Pos height; /* text height in 26.6 frac. pixels */
  1055. FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
  1056. } FT_Size_Metrics;
  1057. /*************************************************************************/
  1058. /* */
  1059. /* <Struct> */
  1060. /* FT_SizeRec */
  1061. /* */
  1062. /* <Description> */
  1063. /* FreeType root size class structure. A size object models the */
  1064. /* resolution and pointsize dependent data of a given face. */
  1065. /* */
  1066. /* <Fields> */
  1067. /* face :: Handle to the parent face object. */
  1068. /* */
  1069. /* generic :: A typeless pointer, which is unused by the FreeType */
  1070. /* library or any of its drivers. It can be used by */
  1071. /* client applications to link their own data to each size */
  1072. /* object. */
  1073. /* */
  1074. /* metrics :: Metrics for this size object. This field is read-only. */
  1075. /* */
  1076. typedef struct FT_SizeRec_
  1077. {
  1078. FT_Face face; /* parent face object */
  1079. FT_Generic generic; /* generic pointer for client uses */
  1080. FT_Size_Metrics metrics; /* size metrics */
  1081. FT_Size_Internal internal;
  1082. } FT_SizeRec;
  1083. /*************************************************************************/
  1084. /* */
  1085. /* <Struct> */
  1086. /* FT_SubGlyph */
  1087. /* */
  1088. /* <Description> */
  1089. /* The subglyph structure is an internal object used to describe */
  1090. /* subglyphs (for example, in the case of composites). */
  1091. /* */
  1092. /* <Note> */
  1093. /* The subglyph implementation is not part of the high-level API, */
  1094. /* hence the forward structure declaration. */
  1095. /* */
  1096. typedef struct FT_SubGlyphRec_* FT_SubGlyph;
  1097. /*************************************************************************/
  1098. /* */
  1099. /* <Type> */
  1100. /* FT_Slot_Internal */
  1101. /* */
  1102. /* <Description> */
  1103. /* An opaque handle to an FT_Slot_InternalRec structure, used to */
  1104. /* model private data of a given FT_GlyphSlot object. */
  1105. /* */
  1106. typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
  1107. /*************************************************************************/
  1108. /* */
  1109. /* <Struct> */
  1110. /* FT_GlyphSlotRec */
  1111. /* */
  1112. /* <Description> */
  1113. /* FreeType root glyph slot class structure. A glyph slot is a */
  1114. /* container where individual glyphs can be loaded, be they */
  1115. /* vectorial or bitmap/graymaps. */
  1116. /* */
  1117. /* <Fields> */
  1118. /* library :: A handle to the FreeType library instance */
  1119. /* this slot belongs to. */
  1120. /* */
  1121. /* face :: A handle to the parent face object. */
  1122. /* */
  1123. /* next :: In some cases (like some font tools), several */
  1124. /* glyph slots per face object can be a good */
  1125. /* thing. As this is rare, the glyph slots are */
  1126. /* listed through a direct, single-linked list */
  1127. /* using its `next' field. */
  1128. /* */
  1129. /* generic :: A typeless pointer which is unused by the */
  1130. /* FreeType library or any of its drivers. It */
  1131. /* can be used by client applications to link */
  1132. /* their own data to each glyph slot object. */
  1133. /* */
  1134. /* metrics :: The metrics of the last loaded glyph in the */
  1135. /* slot. The returned values depend on the last */
  1136. /* load flags (see the @FT_Load_Glyph API */
  1137. /* function) and can be expressed either in 26.6 */
  1138. /* fractional pixels or font units. */
  1139. /* */
  1140. /* Note that even when the glyph image is */
  1141. /* transformed, the metrics are not. */
  1142. /* */
  1143. /* linearHoriAdvance :: For scalable formats only, this field holds */
  1144. /* the linearly scaled horizontal advance width */
  1145. /* for the glyph (i.e. the scaled and unhinted */
  1146. /* value of the hori advance). This can be */
  1147. /* important to perform correct WYSIWYG layout. */
  1148. /* */
  1149. /* Note that this value is expressed by default */
  1150. /* in 16.16 pixels. However, when the glyph is */
  1151. /* loaded with the FT_LOAD_LINEAR_DESIGN flag, */
  1152. /* this field contains simply the value of the */
  1153. /* advance in original font units. */
  1154. /* */
  1155. /* linearVertAdvance :: For scalable formats only, this field holds */
  1156. /* the linearly scaled vertical advance height */
  1157. /* for the glyph. See linearHoriAdvance for */
  1158. /* comments. */
  1159. /* */
  1160. /* advance :: This is the transformed advance width for the */
  1161. /* glyph. */
  1162. /* */
  1163. /* format :: This field indicates the format of the image */
  1164. /* contained in the glyph slot. Typically */
  1165. /* FT_GLYPH_FORMAT_BITMAP, */
  1166. /* FT_GLYPH_FORMAT_OUTLINE, and */
  1167. /* FT_GLYPH_FORMAT_COMPOSITE, but others are */
  1168. /* possible. */
  1169. /* */
  1170. /* bitmap :: This field is used as a bitmap descriptor */
  1171. /* when the slot format is */
  1172. /* FT_GLYPH_FORMAT_BITMAP. Note that the */
  1173. /* address and content of the bitmap buffer can */
  1174. /* change between calls of @FT_Load_Glyph and a */
  1175. /* few other functions. */
  1176. /* */
  1177. /* bitmap_left :: This is the bitmap's left bearing expressed */
  1178. /* in integer pixels. Of course, this is only */
  1179. /* valid if the format is */
  1180. /* FT_GLYPH_FORMAT_BITMAP. */
  1181. /* */
  1182. /* bitmap_top :: This is the bitmap's top bearing expressed in */
  1183. /* integer pixels. Remember that this is the */
  1184. /* distance from the baseline to the top-most */
  1185. /* glyph scanline, upwards y-coordinates being */
  1186. /* *positive*. */
  1187. /* */
  1188. /* outline :: The outline descriptor for the current glyph */
  1189. /* image if its format is */
  1190. /* ft_glyph_bitmap_outline. */
  1191. /* */
  1192. /* num_subglyphs :: The number of subglyphs in a composite glyph. */
  1193. /* This format is only valid for the composite */
  1194. /* glyph format, that should normally only be */
  1195. /* loaded with the FT_LOAD_NO_RECURSE flag. */
  1196. /* */
  1197. /* subglyphs :: An array of subglyph descriptors for */
  1198. /* composite glyphs. There are `num_subglyphs' */
  1199. /* elements in there. */
  1200. /* */
  1201. /* control_data :: Certain font drivers can also return the */
  1202. /* control data for a given glyph image (e.g. */
  1203. /* TrueType bytecode, Type 1 charstrings, etc.). */
  1204. /* This field is a pointer to such data. */
  1205. /* */
  1206. /* control_len :: This is the length in bytes of the control */
  1207. /* data. */
  1208. /* */
  1209. /* other :: Really wicked formats can use this pointer to */
  1210. /* present their own glyph image to client apps. */
  1211. /* Note that the app will need to know about the */
  1212. /* image format. */
  1213. /* */
  1214. /* <Note> */
  1215. /* If @FT_Load_Glyph is called with default flags (see */
  1216. /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
  1217. /* its native format (e.g. a vectorial outline for TrueType and */
  1218. /* Type 1 formats). */
  1219. /* */
  1220. /* This image can later be converted into a bitmap by calling */
  1221. /* @FT_Render_Glyph. This function finds the current renderer for */
  1222. /* the native image's format then invokes it. */
  1223. /* */
  1224. /* The renderer is in charge of transforming the native image through */
  1225. /* the slot's face transformation fields, then convert it into a */
  1226. /* bitmap that is returned in `slot->bitmap'. */
  1227. /* */
  1228. /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
  1229. /* to specify the position of the bitmap relative to the current pen */
  1230. /* position (e.g. coordinates [0,0] on the baseline). Of course, */
  1231. /* `slot->format' is also changed to `FT_GLYPH_FORMAT_BITMAP' . */
  1232. /* */
  1233. typedef struct FT_GlyphSlotRec_
  1234. {
  1235. FT_Library library;
  1236. FT_Face face;
  1237. FT_GlyphSlot next;
  1238. FT_UInt flags;
  1239. FT_Generic generic;
  1240. FT_Glyph_Metrics metrics;
  1241. FT_Fixed linearHoriAdvance;
  1242. FT_Fixed linearVertAdvance;
  1243. FT_Vector advance;
  1244. FT_Glyph_Format format;
  1245. FT_Bitmap bitmap;
  1246. FT_Int bitmap_left;
  1247. FT_Int bitmap_top;
  1248. FT_Outline outline;
  1249. FT_UInt num_subglyphs;
  1250. FT_SubGlyph subglyphs;
  1251. void* control_data;
  1252. long control_len;
  1253. void* other;
  1254. FT_Slot_Internal internal;
  1255. } FT_GlyphSlotRec;
  1256. /*************************************************************************/
  1257. /*************************************************************************/
  1258. /* */
  1259. /* F U N C T I O N S */
  1260. /* */
  1261. /*************************************************************************/
  1262. /*************************************************************************/
  1263. /*************************************************************************/
  1264. /* */
  1265. /* <Function> */
  1266. /* FT_Init_FreeType */
  1267. /* */
  1268. /* <Description> */
  1269. /* Initializes a new FreeType library object. The set of modules */
  1270. /* that are registered by this function is determined at build time. */
  1271. /* */
  1272. /* <Output> */
  1273. /* alibrary :: A handle to a new library object. */
  1274. /* */
  1275. /* <Return> */
  1276. /* FreeType error code. 0 means success. */
  1277. /* */
  1278. FT_EXPORT( FT_Error )
  1279. FT_Init_FreeType( FT_Library *alibrary );
  1280. /*************************************************************************/
  1281. /* */
  1282. /* <Function> */
  1283. /* FT_Library_Version */
  1284. /* */
  1285. /* <Description> */
  1286. /* Return the version of the FreeType library being used. This is */
  1287. /* useful when dynamically linking to the library, since one cannot */
  1288. /* use the macros FT_FREETYPE_MAJOR, FT_FREETYPE_MINOR, and */
  1289. /* FT_FREETYPE_PATCH. */
  1290. /* */
  1291. /* <Input> */
  1292. /* library :: A source library handle. */
  1293. /* */
  1294. /* <Output> */
  1295. /* amajor :: The major version number. */
  1296. /* */
  1297. /* aminor :: The minor version number. */
  1298. /* */
  1299. /* apatch :: The patch version number. */
  1300. /* */
  1301. /* <Note> */
  1302. /* The reason why this function takes a 'library' argument is because */
  1303. /* certain programs implement library initialization in a custom way */
  1304. /* that doesn't use `FT_Init_FreeType'. */
  1305. /* */
  1306. /* In such cases, the library version might not be available before */
  1307. /* the library object has been created. */
  1308. /* */
  1309. FT_EXPORT( void )
  1310. FT_Library_Version( FT_Library library,
  1311. FT_Int *amajor,
  1312. FT_Int *aminor,
  1313. FT_Int *apatch );
  1314. /*************************************************************************/
  1315. /* */
  1316. /* <Function> */
  1317. /* FT_Done_FreeType */
  1318. /* */
  1319. /* <Description> */
  1320. /* Destroys a given FreeType library object and all of its childs, */
  1321. /* including resources, drivers, faces, sizes, etc. */
  1322. /* */
  1323. /* <Input> */
  1324. /* library :: A handle to the target library object. */
  1325. /* */
  1326. /* <Return> */
  1327. /* FreeType error code. 0 means success. */
  1328. /* */
  1329. FT_EXPORT( FT_Error )
  1330. FT_Done_FreeType( FT_Library library );
  1331. /*************************************************************************/
  1332. /* */
  1333. /* <Enum> */
  1334. /* FT_Open_Flags */
  1335. /* */
  1336. /* <Description> */
  1337. /* An enumeration used to list the bit flags used within the */
  1338. /* `flags' field of the @FT_Open_Args structure. */
  1339. /* */
  1340. /* <Fields> */
  1341. /* FT_OPEN_MEMORY :: This is a memory-based stream. */
  1342. /* */
  1343. /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
  1344. /* */
  1345. /* FT_OPEN_PATHNAME :: Create a new input stream from a C */
  1346. /* path name. */
  1347. /* */
  1348. /* FT_OPEN_DRIVER :: Use the `driver' field. */
  1349. /* */
  1350. /* FT_OPEN_PARAMS :: Use the `num_params' & `params' field. */
  1351. /* */
  1352. /* ft_open_memory :: deprecated. use @FT_OPEN_MEMORY instead */
  1353. /* */
  1354. /* ft_open_stream :: deprecated. use @FT_OPEN_STREAM instead */
  1355. /* */
  1356. /* ft_open_pathname :: deprecated. use @FT_OPEN_PATHNAME instead */
  1357. /* */
  1358. /* ft_open_driver :: deprecated, use @FT_OPEN_DRIVER instead */
  1359. /* */
  1360. /* ft_open_params :: deprecated, use @FT_OPEN_PARAMS instead */
  1361. /* */
  1362. /* <Note> */
  1363. /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
  1364. /* flags are mutually exclusive. */
  1365. /* */
  1366. typedef enum
  1367. {
  1368. FT_OPEN_MEMORY = 1,
  1369. FT_OPEN_STREAM = 2,
  1370. FT_OPEN_PATHNAME = 4,
  1371. FT_OPEN_DRIVER = 8,
  1372. FT_OPEN_PARAMS = 16
  1373. } FT_Open_Flags;
  1374. #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
  1375. #define ft_open_stream FT_OPEN_STREAM /* deprecated */
  1376. #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
  1377. #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
  1378. #define ft_open_params FT_OPEN_PARAMS /* deprecated */
  1379. /*************************************************************************/
  1380. /* */
  1381. /* <Struct> */
  1382. /* FT_Parameter */
  1383. /* */
  1384. /* <Description> */
  1385. /* A simple structure used to pass more or less generic parameters */
  1386. /* to @FT_Open_Face. */
  1387. /* */
  1388. /* <Fields> */
  1389. /* tag :: A 4-byte identification tag. */
  1390. /* */
  1391. /* data :: A pointer to the parameter data. */
  1392. /* */
  1393. /* <Note> */
  1394. /* The id and function of parameters are driver-specific. */
  1395. /* */
  1396. typedef struct FT_Parameter_
  1397. {
  1398. FT_ULong tag;
  1399. FT_Pointer data;
  1400. } FT_Parameter;
  1401. /*************************************************************************/
  1402. /* */
  1403. /* <Struct> */
  1404. /* FT_Open_Args */
  1405. /* */
  1406. /* <Description> */
  1407. /* A structure used to indicate how to open a new font file/stream. */
  1408. /* A pointer to such a structure can be used as a parameter for the */
  1409. /* functions @FT_Open_Face and @FT_Attach_Stream. */
  1410. /* */
  1411. /* <Fields> */
  1412. /* flags :: A set of bit flags indicating how to use the */
  1413. /* structure. */
  1414. /* */
  1415. /* memory_base :: The first byte of the file in memory. */
  1416. /* */
  1417. /* memory_size :: The size in bytes of the file in memory. */
  1418. /* */
  1419. /* pathname :: A pointer to an 8-bit file pathname. */
  1420. /* */
  1421. /* stream :: A handle to a source stream object. */
  1422. /* */
  1423. /* driver :: This field is exclusively used by @FT_Open_Face; */
  1424. /* it simply specifies the font driver to use to open */
  1425. /* the face. If set to 0, FreeType will try to load */
  1426. /* the face with each one of the drivers in its list. */
  1427. /* */
  1428. /* num_params :: The number of extra parameters. */
  1429. /* */
  1430. /* params :: Extra parameters passed to the font driver when */
  1431. /* opening a new face. */
  1432. /* */
  1433. /* <Note> */
  1434. /* The stream type is determined by the contents of `flags' which */
  1435. /* are tested in the following order by @FT_Open_Face: */
  1436. /* */
  1437. /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
  1438. /* memory file of `memory_size' bytes,located at `memory_address'. */
  1439. /* */
  1440. /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
  1441. /* custom input stream `stream' is used. */
  1442. /* */
  1443. /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
  1444. /* is a normal file and use `pathname' to open it. */
  1445. /* */
  1446. /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face will only try to */
  1447. /* open the file with the driver whose handler is in `driver'. */
  1448. /* */
  1449. /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
  1450. /* `num_params' and `params' will be used. They are ignored */
  1451. /* otherwise. */
  1452. /* */
  1453. typedef struct FT_Open_Args_
  1454. {
  1455. FT_Open_Flags flags;
  1456. const FT_Byte* memory_base;
  1457. FT_Long memory_size;
  1458. FT_String* pathname;
  1459. FT_Stream stream;
  1460. FT_Module driver;
  1461. FT_Int num_params;
  1462. FT_Parameter* params;
  1463. } FT_Open_Args;
  1464. /*************************************************************************/
  1465. /* */
  1466. /* <Function> */
  1467. /* FT_New_Face */
  1468. /* */
  1469. /* <Description> */
  1470. /* Creates a new face object from a given resource and typeface index */
  1471. /* using a pathname to the font file. */
  1472. /* */
  1473. /* <InOut> */
  1474. /* library :: A handle to the library resource. */
  1475. /* */
  1476. /* <Input> */
  1477. /* pathname :: A path to the font file. */
  1478. /* */
  1479. /* face_index :: The index of the face within the resource. The */
  1480. /* first face has index 0. */
  1481. /* <Output> */
  1482. /* aface :: A handle to a new face object. */
  1483. /* */
  1484. /* <Return> */
  1485. /* FreeType error code. 0 means success. */
  1486. /* */
  1487. /* <Note> */
  1488. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  1489. /* slot for the face object which can be accessed directly through */
  1490. /* `face->glyph'. */
  1491. /* */
  1492. /* @FT_New_Face can be used to determine and/or check the font format */
  1493. /* of a given font resource. If the `face_index' field is negative, */
  1494. /* the function will _not_ return any face handle in `aface'. Its */
  1495. /* return value should be 0 if the font format is recognized, or */
  1496. /* non-zero otherwise. */
  1497. /* */
  1498. /* Each new face object created with this function also owns a */
  1499. /* default @FT_Size object, accessible as `face->size'. */
  1500. /* */
  1501. FT_EXPORT( FT_Error )
  1502. FT_New_Face( FT_Library library,
  1503. const char* filepathname,
  1504. FT_Long face_index,
  1505. FT_Face *aface );
  1506. /*************************************************************************/
  1507. /* */
  1508. /* <Function> */
  1509. /* FT_New_Memory_Face */
  1510. /* */
  1511. /* <Description> */
  1512. /* Creates a new face object from a given resource and typeface index */
  1513. /* using a font file already loaded into memory. */
  1514. /* */
  1515. /* <InOut> */
  1516. /* library :: A handle to the library resource. */
  1517. /* */
  1518. /* <Input> */
  1519. /* file_base :: A pointer to the beginning of the font data. */
  1520. /* */
  1521. /* file_size :: The size of the memory chunk used by the font data. */
  1522. /* */
  1523. /* face_index :: The index of the face within the resource. The */
  1524. /* first face has index 0. */
  1525. /* <Output> */
  1526. /* aface :: A handle to a new face object. */
  1527. /* */
  1528. /* <Return> */
  1529. /* FreeType error code. 0 means success. */
  1530. /* */
  1531. /* <Note> */
  1532. /* The font data bytes are used _directly_ by the @FT_Face object. */
  1533. /* This means that they are not copied, and that the client is */
  1534. /* responsible for releasing/destroying them _after_ the */
  1535. /* corresponding call to @FT_Done_Face . */
  1536. /* */
  1537. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  1538. /* slot for the face object which can be accessed directly through */
  1539. /* `face->glyph'. */
  1540. /* */
  1541. /* @FT_New_Memory_Face can be used to determine and/or check the font */
  1542. /* format of a given font resource. If the `face_index' field is */
  1543. /* negative, the function will _not_ return any face handle in */
  1544. /* `aface'. Its return value should be 0 if the font format is */
  1545. /* recognized, or non-zero otherwise. */
  1546. /* */
  1547. FT_EXPORT( FT_Error )
  1548. FT_New_Memory_Face( FT_Library library,
  1549. const FT_Byte* file_base,
  1550. FT_Long file_size,
  1551. FT_Long face_index,
  1552. FT_Face *aface );
  1553. /*************************************************************************/
  1554. /* */
  1555. /* <Function> */
  1556. /* FT_Open_Face */
  1557. /* */
  1558. /* <Description> */
  1559. /* Opens a face object from a given resource and typeface index using */
  1560. /* an `FT_Open_Args' structure. If the face object doesn't exist, it */
  1561. /* will be created. */
  1562. /* */
  1563. /* <InOut> */
  1564. /* library :: A handle to the library resource. */
  1565. /* */
  1566. /* <Input> */
  1567. /* args :: A pointer to an `FT_Open_Args' structure which must */
  1568. /* be filled by the caller. */
  1569. /* */
  1570. /* face_index :: The index of the face within the resource. The */
  1571. /* first face has index 0. */
  1572. /* <Output> */
  1573. /* aface :: A handle to a new face object. */
  1574. /* */
  1575. /* <Return> */
  1576. /* FreeType error code. 0 means success. */
  1577. /* */
  1578. /* <Note> */
  1579. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  1580. /* slot for the face object which can be accessed directly through */
  1581. /* `face->glyph'. */
  1582. /* */
  1583. /* @FT_Open_Face can be used to determine and/or check the font */
  1584. /* format of a given font resource. If the `face_index' field is */
  1585. /* negative, the function will _not_ return any face handle in */
  1586. /* `*face'. Its return value should be 0 if the font format is */
  1587. /* recognized, or non-zero otherwise. */
  1588. /* */
  1589. FT_EXPORT( FT_Error )
  1590. FT_Open_Face( FT_Library library,
  1591. const FT_Open_Args* args,
  1592. FT_Long face_index,
  1593. FT_Face *aface );
  1594. /*************************************************************************/
  1595. /* */
  1596. /* <Function> */
  1597. /* FT_Attach_File */
  1598. /* */
  1599. /* <Description> */
  1600. /* `Attaches' a given font file to an existing face. This is usually */
  1601. /* to read additional information for a single face object. For */
  1602. /* example, it is used to read the AFM files that come with Type 1 */
  1603. /* fonts in order to add kerning data and other metrics. */
  1604. /* */
  1605. /* <InOut> */
  1606. /* face :: The target face object. */
  1607. /* */
  1608. /* <Input> */
  1609. /* filepathname :: An 8-bit pathname naming the `metrics' file. */
  1610. /* */
  1611. /* <Return> */
  1612. /* FreeType error code. 0 means success. */
  1613. /* */
  1614. /* <Note> */
  1615. /* If your font file is in memory, or if you want to provide your */
  1616. /* own input stream object, use @FT_Attach_Stream. */
  1617. /* */
  1618. /* The meaning of the `attach' action (i.e., what really happens when */
  1619. /* the new file is read) is not fixed by FreeType itself. It really */
  1620. /* depends on the font format (and thus the font driver). */
  1621. /* */
  1622. /* Client applications are expected to know what they are doing */
  1623. /* when invoking this function. Most drivers simply do not implement */
  1624. /* file attachments. */
  1625. /* */
  1626. FT_EXPORT( FT_Error )
  1627. FT_Attach_File( FT_Face face,
  1628. const char* filepathname );
  1629. /*************************************************************************/
  1630. /* */
  1631. /* <Function> */
  1632. /* FT_Attach_Stream */
  1633. /* */
  1634. /* <Description> */
  1635. /* This function is similar to @FT_Attach_File with the exception */
  1636. /* that it reads the attachment from an arbitrary stream. */
  1637. /* */
  1638. /* <InOut> */
  1639. /* face :: The target face object. */
  1640. /* */
  1641. /* <Input> */
  1642. /* parameters :: A pointer to an FT_Open_Args structure used to */
  1643. /* describe the input stream to FreeType. */
  1644. /* <Return> */
  1645. /* FreeType error code. 0 means success. */
  1646. /* */
  1647. /* <Note> */
  1648. /* The meaning of the `attach' (i.e. what really happens when the */
  1649. /* new file is read) is not fixed by FreeType itself. It really */
  1650. /* depends on the font format (and thus the font driver). */
  1651. /* */
  1652. /* Client applications are expected to know what they are doing */
  1653. /* when invoking this function. Most drivers simply do not implement */
  1654. /* file attachments. */
  1655. /* */
  1656. FT_EXPORT( FT_Error )
  1657. FT_Attach_Stream( FT_Face face,
  1658. FT_Open_Args* parameters );
  1659. /*************************************************************************/
  1660. /* */
  1661. /* <Function> */
  1662. /* FT_Done_Face */
  1663. /* */
  1664. /* <Description> */
  1665. /* Discards a given face object, as well as all of its child slots */
  1666. /* and sizes. */
  1667. /* */
  1668. /* <Input> */
  1669. /* face :: A handle to a target face object. */
  1670. /* */
  1671. /* <Return> */
  1672. /* FreeType error code. 0 means success. */
  1673. /* */
  1674. FT_EXPORT( FT_Error )
  1675. FT_Done_Face( FT_Face face );
  1676. /*************************************************************************/
  1677. /* */
  1678. /* <Function> */
  1679. /* FT_Set_Char_Size */
  1680. /* */
  1681. /* <Description> */
  1682. /* Sets the character dimensions of a given face object. The */
  1683. /* `char_width' and `char_height' values are used for the width and */
  1684. /* height, respectively, expressed in 26.6 fractional points. */
  1685. /* */
  1686. /* If the horizontal or vertical resolution values are zero, a */
  1687. /* default value of 72dpi is used. Similarly, if one of the */
  1688. /* character dimensions is zero, its value is set equal to the other. */
  1689. /* */
  1690. /* <InOut> */
  1691. /* size :: A handle to a target size object. */
  1692. /* */
  1693. /* <Input> */
  1694. /* char_width :: The character width, in 26.6 fractional points. */
  1695. /* */
  1696. /* char_height :: The character height, in 26.6 fractional */
  1697. /* points. */
  1698. /* */
  1699. /* horz_resolution :: The horizontal resolution. */
  1700. /* */
  1701. /* vert_resolution :: The vertical resolution. */
  1702. /* */
  1703. /* <Return> */
  1704. /* FreeType error code. 0 means success. */
  1705. /* */
  1706. /* <Note> */
  1707. /* When dealing with fixed-size faces (i.e., non-scalable formats), */
  1708. /* use the function @FT_Set_Pixel_Sizes. */
  1709. /* */
  1710. FT_EXPORT( FT_Error )
  1711. FT_Set_Char_Size( FT_Face face,
  1712. FT_F26Dot6 char_width,
  1713. FT_F26Dot6 char_height,
  1714. FT_UInt horz_resolution,
  1715. FT_UInt vert_resolution );
  1716. /*************************************************************************/
  1717. /* */
  1718. /* <Function> */
  1719. /* FT_Set_Pixel_Sizes */
  1720. /* */
  1721. /* <Description> */
  1722. /* Sets the character dimensions of a given face object. The width */
  1723. /* and height are expressed in integer pixels. */
  1724. /* */
  1725. /* If one of the character dimensions is zero, its value is set equal */
  1726. /* to the other. */
  1727. /* */
  1728. /* <InOut> */
  1729. /* face :: A handle to the target face object. */
  1730. /* */
  1731. /* <Input> */
  1732. /* pixel_width :: The character width, in integer pixels. */
  1733. /* */
  1734. /* pixel_height :: The character height, in integer pixels. */
  1735. /* */
  1736. /* <Return> */
  1737. /* FreeType error code. 0 means success. */
  1738. /* */
  1739. /* */
  1740. /* <Note> */
  1741. /* The values of `pixel_width' and `pixel_height' correspond to the */
  1742. /* pixel values of the _typographic_ character size, which are NOT */
  1743. /* necessarily the same as the dimensions of the glyph `bitmap */
  1744. /* cells'. */
  1745. /* */
  1746. /* The `character size' is really the size of an abstract square */
  1747. /* called the `EM', used to design the font. However, depending */
  1748. /* on the font design, glyphs will be smaller or greater than the */
  1749. /* EM. */
  1750. /* */
  1751. /* This means that setting the pixel size to, say, 8x8 doesn't */
  1752. /* guarantee in any way that you will get glyph bitmaps that all fit */
  1753. /* within an 8x8 cell (sometimes even far from it). */
  1754. /* */
  1755. FT_EXPORT( FT_Error )
  1756. FT_Set_Pixel_Sizes( FT_Face face,
  1757. FT_UInt pixel_width,
  1758. FT_UInt pixel_height );
  1759. /*************************************************************************/
  1760. /* */
  1761. /* <Function> */
  1762. /* FT_Load_Glyph */
  1763. /* */
  1764. /* <Description> */
  1765. /* A function used to load a single glyph within a given glyph slot, */
  1766. /* for a given size. */
  1767. /* */
  1768. /* <InOut> */
  1769. /* face :: A handle to the target face object where the glyph */
  1770. /* will be loaded. */
  1771. /* */
  1772. /* <Input> */
  1773. /* glyph_index :: The index of the glyph in the font file. */
  1774. /* */
  1775. /* load_flags :: A flag indicating what to load for this glyph. The */
  1776. /* @FT_LOAD_XXX constants can be used to control the */
  1777. /* glyph loading process (e.g., whether the outline */
  1778. /* should be scaled, whether to load bitmaps or not, */
  1779. /* whether to hint the outline, etc). */
  1780. /* */
  1781. /* <Return> */
  1782. /* FreeType error code. 0 means success. */
  1783. /* */
  1784. /* <Note> */
  1785. /* If the glyph image is not a bitmap, and if the bit flag */
  1786. /* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */
  1787. /* transformed with the information passed to a previous call to */
  1788. /* @FT_Set_Transform. */
  1789. /* */
  1790. /* Note that this also transforms the `face.glyph.advance' field, but */
  1791. /* *not* the values in `face.glyph.metrics'. */
  1792. /* */
  1793. FT_EXPORT( FT_Error )
  1794. FT_Load_Glyph( FT_Face face,
  1795. FT_UInt glyph_index,
  1796. FT_Int32 load_flags );
  1797. /*************************************************************************/
  1798. /* */
  1799. /* <Function> */
  1800. /* FT_Load_Char */
  1801. /* */
  1802. /* <Description> */
  1803. /* A function used to load a single glyph within a given glyph slot, */
  1804. /* for a given size, according to its character code. */
  1805. /* */
  1806. /* <InOut> */
  1807. /* face :: A handle to a target face object where the glyph */
  1808. /* will be loaded. */
  1809. /* */
  1810. /* <Input> */
  1811. /* char_code :: The glyph's character code, according to the */
  1812. /* current charmap used in the face. */
  1813. /* */
  1814. /* load_flags :: A flag indicating what to load for this glyph. The */
  1815. /* @FT_LOAD_XXX constants can be used to control the */
  1816. /* glyph loading process (e.g., whether the outline */
  1817. /* should be scaled, whether to load bitmaps or not, */
  1818. /* whether to hint the outline, etc). */
  1819. /* */
  1820. /* <Return> */
  1821. /* FreeType error code. 0 means success. */
  1822. /* */
  1823. /* <Note> */
  1824. /* If the face has no current charmap, or if the character code */
  1825. /* is not defined in the charmap, this function will return an */
  1826. /* error. */
  1827. /* */
  1828. /* If the glyph image is not a bitmap, and if the bit flag */
  1829. /* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */
  1830. /* transformed with the information passed to a previous call to */
  1831. /* @FT_Set_Transform. */
  1832. /* */
  1833. /* Note that this also transforms the `face.glyph.advance' field, but */
  1834. /* *not* the values in `face.glyph.metrics'. */
  1835. /* */
  1836. FT_EXPORT( FT_Error )
  1837. FT_Load_Char( FT_Face face,
  1838. FT_ULong char_code,
  1839. FT_Int32 load_flags );
  1840. /****************************************************************************
  1841. *
  1842. * @enum:
  1843. * FT_LOAD_XXX
  1844. *
  1845. * @description:
  1846. * A list of bit-field constants, used with @FT_Load_Glyph to indicate
  1847. * what kind of operations to perform during glyph loading.
  1848. *
  1849. * @values:
  1850. * FT_LOAD_DEFAULT ::
  1851. * Corresponding to 0, this value is used a default glyph load. In this
  1852. * case, the following will happen:
  1853. *
  1854. * 1. FreeType looks for a bitmap for the glyph corresponding to the
  1855. * face's current size. If one is found, the function returns. The
  1856. * bitmap data can be accessed from the glyph slot (see note below).
  1857. *
  1858. * 2. If no embedded bitmap is searched or found, FreeType looks for a
  1859. * scalable outline. If one is found, it is loaded from the font
  1860. * file, scaled to device pixels, then "hinted" to the pixel grid in
  1861. * order to optimize it. The outline data can be accessed from the
  1862. * glyph slot (see note below).
  1863. *
  1864. * Note that by default, the glyph loader doesn't render outlines into
  1865. * bitmaps. The following flags are used to modify this default
  1866. * behaviour to more specific and useful cases.
  1867. *
  1868. * FT_LOAD_NO_SCALE ::
  1869. * Don't scale the vector outline being loaded to 26.6 fractional
  1870. * pixels, but kept in font units. Note that this also disables
  1871. * hinting and the loading of embedded bitmaps. You should only use it
  1872. * when you want to retrieve the original glyph outlines in font units.
  1873. *
  1874. * FT_LOAD_NO_HINTING ::
  1875. * Don't hint glyph outlines after their scaling to device pixels.
  1876. * This generally generates "blurrier" glyphs in anti-aliased modes.
  1877. *
  1878. * This flag is ignored if @FT_LOAD_NO_SCALE is set.
  1879. *
  1880. * FT_LOAD_RENDER ::
  1881. * Render the glyph outline immediately into a bitmap before the glyph
  1882. * loader returns. By default, the glyph is rendered for the
  1883. * @FT_RENDER_MODE_NORMAL mode, which corresponds to 8-bit anti-aliased
  1884. * bitmaps using 256 opacity levels. You can use either
  1885. * @FT_LOAD_TARGET_MONO or @FT_LOAD_MONOCHROME to render 1-bit
  1886. * monochrome bitmaps.
  1887. *
  1888. * This flag is ignored if @FT_LOAD_NO_SCALE is set.
  1889. *
  1890. * FT_LOAD_NO_BITMAP ::
  1891. * Don't look for bitmaps when loading the glyph. Only scalable
  1892. * outlines will be loaded when available, and scaled, hinted, or
  1893. * rendered depending on other bit flags.
  1894. *
  1895. * This does not prevent you from rendering outlines to bitmaps
  1896. * with @FT_LOAD_RENDER, however.
  1897. *
  1898. * FT_LOAD_VERTICAL_LAYOUT ::
  1899. * Prepare the glyph image for vertical text layout. This basically
  1900. * means that `face.glyph.advance' will correspond to the vertical
  1901. * advance height (instead of the default horizontal advance width),
  1902. * and that the glyph image will be translated to match the vertical
  1903. * bearings positions.
  1904. *
  1905. * FT_LOAD_FORCE_AUTOHINT ::
  1906. * Force the use of the FreeType auto-hinter when a glyph outline is
  1907. * loaded. You shouldn't need this in a typical application, since it
  1908. * is mostly used to experiment with its algorithm.
  1909. *
  1910. * FT_LOAD_CROP_BITMAP ::
  1911. * Indicates that the glyph loader should try to crop the bitmap (i.e.,
  1912. * remove all space around its black bits) when loading it. This is
  1913. * only useful when loading embedded bitmaps in certain fonts, since
  1914. * bitmaps rendered with @FT_LOAD_RENDER are always cropped by default.
  1915. *
  1916. * FT_LOAD_PEDANTIC ::
  1917. * Indicates that the glyph loader should perform pedantic
  1918. * verifications during glyph loading, rejecting invalid fonts. This
  1919. * is mostly used to detect broken glyphs in fonts. By default,
  1920. * FreeType tries to handle broken fonts also.
  1921. *
  1922. * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
  1923. * Indicates that the glyph loader should ignore the global advance
  1924. * width defined in the font. As far as we know, this is only used by
  1925. * the X-TrueType font server, in order to deal correctly with the
  1926. * incorrect metrics contained in DynaLab's TrueType CJK fonts.
  1927. *
  1928. * FT_LOAD_NO_RECURSE ::
  1929. * This flag is only used internally. It merely indicates that the
  1930. * glyph loader should not load composite glyphs recursively. Instead,
  1931. * it should set the `num_subglyph' and `subglyphs' values of the glyph
  1932. * slot accordingly, and set "glyph->format" to
  1933. * @FT_GLYPH_FORMAT_COMPOSITE.
  1934. *
  1935. * The description of sub-glyphs is not available to client
  1936. * applications for now.
  1937. *
  1938. * FT_LOAD_IGNORE_TRANSFORM ::
  1939. * Indicates that the glyph loader should not try to transform the
  1940. * loaded glyph image. This doesn't prevent scaling, hinting, or
  1941. * rendering.
  1942. *
  1943. * FT_LOAD_MONOCHROME ::
  1944. * This flag is used with @FT_LOAD_RENDER to indicate that you want
  1945. * to render a 1-bit monochrome glyph bitmap from a vectorial outline.
  1946. *
  1947. * Note that this has no effect on the hinting algorithm used by the
  1948. * glyph loader. You should better use @FT_LOAD_TARGET_MONO if you
  1949. * want to render monochrome-optimized glyph images instead.
  1950. *
  1951. * FT_LOAD_LINEAR_DESIGN ::
  1952. * Return the linearly scaled metrics expressed in original font units
  1953. * instead of the default 16.16 pixel values.
  1954. *
  1955. * FT_LOAD_NO_AUTOHINT ::
  1956. * Indicates that the auto-hinter should never be used to hint glyph
  1957. * outlines. This doesn't prevent native format-specific hinters from
  1958. * being used. This can be important for certain fonts where unhinted
  1959. * output is better than auto-hinted one.
  1960. */
  1961. #define FT_LOAD_NO_SCALE 0x1
  1962. #define FT_LOAD_NO_HINTING 0x2
  1963. #define FT_LOAD_RENDER 0x4
  1964. #define FT_LOAD_NO_BITMAP 0x8
  1965. #define FT_LOAD_VERTICAL_LAYOUT 0x10
  1966. #define FT_LOAD_FORCE_AUTOHINT 0x20
  1967. #define FT_LOAD_CROP_BITMAP 0x40
  1968. #define FT_LOAD_PEDANTIC 0x80
  1969. #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
  1970. #define FT_LOAD_NO_RECURSE 0x400
  1971. #define FT_LOAD_IGNORE_TRANSFORM 0x800
  1972. #define FT_LOAD_MONOCHROME 0x1000
  1973. #define FT_LOAD_LINEAR_DESIGN 0x2000
  1974. /* temporary hack! */
  1975. #define FT_LOAD_SBITS_ONLY 0x4000
  1976. #define FT_LOAD_NO_AUTOHINT 0x8000U
  1977. /* */
  1978. #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
  1979. #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
  1980. #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
  1981. #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
  1982. #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
  1983. #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
  1984. #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
  1985. #define FT_LOAD_DEFAULT 0x0
  1986. /*************************************************************************/
  1987. /* */
  1988. /* <Function> */
  1989. /* FT_Set_Transform */
  1990. /* */
  1991. /* <Description> */
  1992. /* A function used to set the transformation that is applied to glyph */
  1993. /* images just before they are converted to bitmaps in a glyph slot */
  1994. /* when @FT_Render_Glyph is called. */
  1995. /* */
  1996. /* <InOut> */
  1997. /* face :: A handle to the source face object. */
  1998. /* */
  1999. /* <Input> */
  2000. /* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */
  2001. /* the identity matrix. */
  2002. /* delta :: A pointer to the translation vector. Use 0 for the null */
  2003. /* vector. */
  2004. /* */
  2005. /* <Note> */
  2006. /* The transformation is only applied to scalable image formats after */
  2007. /* the glyph has been loaded. It means that hinting is unaltered by */
  2008. /* the transformation and is performed on the character size given in */
  2009. /* the last call to @FT_Set_Char_Sizes or @FT_Set_Pixel_Sizes. */
  2010. /* */
  2011. FT_EXPORT( void )
  2012. FT_Set_Transform( FT_Face face,
  2013. FT_Matrix* matrix,
  2014. FT_Vector* delta );
  2015. /*************************************************************************/
  2016. /* */
  2017. /* <Enum> */
  2018. /* FT_Render_Mode */
  2019. /* */
  2020. /* <Description> */
  2021. /* An enumeration type that lists the render modes supported by */
  2022. /* FreeType 2. Each mode corresponds to a specific type of scanline */
  2023. /* conversion performed on the outline, as well as specific */
  2024. /* hinting optimizations. */
  2025. /* */
  2026. /* <Values> */
  2027. /* FT_RENDER_MODE_NORMAL :: */
  2028. /* This is the default render mode; it corresponds to 8-bit */
  2029. /* anti-aliased bitmaps, using 256 levels of opacity. */
  2030. /* */
  2031. /* FT_RENDER_MODE_LIGHT :: */
  2032. /* This is similar to @FT_RENDER_MODE_NORMAL, except that this */
  2033. /* changes the hinting to prevent stem width quantization. This */
  2034. /* results in glyph shapes that are more similar to the original, */
  2035. /* while being a bit more fuzzy ("better shapes", instead of */
  2036. /* "better contrast" if you want :-) THIS IS STILL EXPERIMENTAL, */
  2037. /* FOR NOW, THIS WILL PRODUCE RESULTS SIMILAR TO NORMAL MODE !! */
  2038. /* */
  2039. /* FT_RENDER_MODE_MONO :: */
  2040. /* This mode corresponds to 1-bit bitmaps. */
  2041. /* */
  2042. /* FT_RENDER_MODE_LCD :: */
  2043. /* This mode corresponds to horizontal RGB/BGR sub-pixel displays, */
  2044. /* like LCD-screens. It produces 8-bit bitmaps that are 3 times */
  2045. /* the width of the original glyph outline in pixels, and which use */
  2046. /* the @FT_PIXEL_MODE_LCD mode. THIS IS STILL EXPERIMENTAL, DO NOT */
  2047. /* USE FOR NOW !! */
  2048. /* */
  2049. /* FT_RENDER_MODE_LCD_V :: */
  2050. /* This mode corresponds to vertical RGB/BGR sub-pixel displays */
  2051. /* (like PDA screens, rotated LCD displays, etc.). It produces */
  2052. /* 8-bit bitmaps that are 3 times the height of the original */
  2053. /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
  2054. /* */
  2055. /* <Note> */
  2056. /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */
  2057. /* _not filtered_ to reduce color-fringes. It is up to the caller to */
  2058. /* perform this pass. THIS IS STILL EXPERIMENTAL, DO NOT USE FOR NOW */
  2059. /* !! */
  2060. /* */
  2061. typedef enum FT_Render_Mode_
  2062. {
  2063. FT_RENDER_MODE_NORMAL = 0,
  2064. FT_RENDER_MODE_LIGHT,
  2065. FT_RENDER_MODE_MONO,
  2066. FT_RENDER_MODE_LCD,
  2067. FT_RENDER_MODE_LCD_V,
  2068. FT_RENDER_MODE_MAX
  2069. } FT_Render_Mode;
  2070. /*************************************************************************/
  2071. /* */
  2072. /* <Enum> */
  2073. /* ft_render_mode_xxx */
  2074. /* */
  2075. /* <Description> */
  2076. /* These constats are deprecated. Use the corresponding */
  2077. /* @FT_Render_Mode values instead. */
  2078. /* */
  2079. /* <Values> */
  2080. /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
  2081. /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
  2082. /* */
  2083. #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
  2084. #define ft_render_mode_mono FT_RENDER_MODE_MONO
  2085. /*************************************************************************/
  2086. /* */
  2087. /* <Function> */
  2088. /* FT_Render_Glyph */
  2089. /* */
  2090. /* <Description> */
  2091. /* Converts a given glyph image to a bitmap. It does so by */
  2092. /* inspecting the glyph image format, find the relevant renderer, and */
  2093. /* invoke it. */
  2094. /* */
  2095. /* <InOut> */
  2096. /* slot :: A handle to the glyph slot containing the image to */
  2097. /* convert. */
  2098. /* */
  2099. /* <Input> */
  2100. /* render_mode :: This is the render mode used to render the glyph */
  2101. /* image into a bitmap. See FT_Render_Mode for a list */
  2102. /* of possible values. */
  2103. /* */
  2104. /* <Return> */
  2105. /* FreeType error code. 0 means success. */
  2106. /* */
  2107. FT_EXPORT( FT_Error )
  2108. FT_Render_Glyph( FT_GlyphSlot slot,
  2109. FT_Render_Mode render_mode );
  2110. /*************************************************************************/
  2111. /* */
  2112. /* <Enum> */
  2113. /* FT_Kerning_Mode */
  2114. /* */
  2115. /* <Description> */
  2116. /* An enumeration used to specify which kerning values to return in */
  2117. /* @FT_Get_Kerning. */
  2118. /* */
  2119. /* <Values> */
  2120. /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
  2121. /* distances (value is 0). */
  2122. /* */
  2123. /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
  2124. /* distances. */
  2125. /* */
  2126. /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
  2127. /* units. */
  2128. /* */
  2129. typedef enum FT_Kerning_Mode_
  2130. {
  2131. FT_KERNING_DEFAULT = 0,
  2132. FT_KERNING_UNFITTED,
  2133. FT_KERNING_UNSCALED
  2134. } FT_Kerning_Mode;
  2135. /*************************************************************************/
  2136. /* */
  2137. /* <Const> */
  2138. /* ft_kerning_default */
  2139. /* */
  2140. /* <Description> */
  2141. /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
  2142. /* instead. */
  2143. /* */
  2144. #define ft_kerning_default FT_KERNING_DEFAULT
  2145. /*************************************************************************/
  2146. /* */
  2147. /* <Const> */
  2148. /* ft_kerning_unfitted */
  2149. /* */
  2150. /* <Description> */
  2151. /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
  2152. /* instead. */
  2153. /* */
  2154. #define ft_kerning_unfitted FT_KERNING_UNFITTED
  2155. /*************************************************************************/
  2156. /* */
  2157. /* <Const> */
  2158. /* ft_kerning_unscaled */
  2159. /* */
  2160. /* <Description> */
  2161. /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
  2162. /* instead. */
  2163. /* */
  2164. #define ft_kerning_unscaled FT_KERNING_UNSCALED
  2165. /*************************************************************************/
  2166. /* */
  2167. /* <Function> */
  2168. /* FT_Get_Kerning */
  2169. /* */
  2170. /* <Description> */
  2171. /* Returns the kerning vector between two glyphs of a same face. */
  2172. /* */
  2173. /* <Input> */
  2174. /* face :: A handle to a source face object. */
  2175. /* */
  2176. /* left_glyph :: The index of the left glyph in the kern pair. */
  2177. /* */
  2178. /* right_glyph :: The index of the right glyph in the kern pair. */
  2179. /* */
  2180. /* kern_mode :: See @FT_Kerning_Mode for more information. */
  2181. /* Determines the scale/dimension of the returned */
  2182. /* kerning vector. */
  2183. /* */
  2184. /* <Output> */
  2185. /* akerning :: The kerning vector. This is in font units for */
  2186. /* scalable formats, and in pixels for fixed-sizes */
  2187. /* formats. */
  2188. /* */
  2189. /* <Return> */
  2190. /* FreeType error code. 0 means success. */
  2191. /* */
  2192. /* <Note> */
  2193. /* Only horizontal layouts (left-to-right & right-to-left) are */
  2194. /* supported by this method. Other layouts, or more sophisticated */
  2195. /* kernings, are out of the scope of this API function -- they can be */
  2196. /* implemented through format-specific interfaces. */
  2197. /* */
  2198. FT_EXPORT( FT_Error )
  2199. FT_Get_Kerning( FT_Face face,
  2200. FT_UInt left_glyph,
  2201. FT_UInt right_glyph,
  2202. FT_UInt kern_mode,
  2203. FT_Vector *akerning );
  2204. /*************************************************************************/
  2205. /* */
  2206. /* <Function> */
  2207. /* FT_Get_Glyph_Name */
  2208. /* */
  2209. /* <Description> */
  2210. /* Retrieves the ASCII name of a given glyph in a face. This only */
  2211. /* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */
  2212. /* */
  2213. /* <Input> */
  2214. /* face :: A handle to a source face object. */
  2215. /* */
  2216. /* glyph_index :: The glyph index. */
  2217. /* */
  2218. /* buffer_max :: The maximal number of bytes available in the */
  2219. /* buffer. */
  2220. /* */
  2221. /* <Output> */
  2222. /* buffer :: A pointer to a target buffer where the name will be */
  2223. /* copied to. */
  2224. /* */
  2225. /* <Return> */
  2226. /* FreeType error code. 0 means success. */
  2227. /* */
  2228. /* <Note> */
  2229. /* An error is returned if the face doesn't provide glyph names or if */
  2230. /* the glyph index is invalid. In all cases of failure, the first */
  2231. /* byte of `buffer' will be set to 0 to indicate an empty name. */
  2232. /* */
  2233. /* The glyph name is truncated to fit within the buffer if it is too */
  2234. /* long. The returned string is always zero-terminated. */
  2235. /* */
  2236. /* This function is not compiled within the library if the config */
  2237. /* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */
  2238. /* `include/freetype/config/ftoptions.h' */
  2239. /* */
  2240. FT_EXPORT( FT_Error )
  2241. FT_Get_Glyph_Name( FT_Face face,
  2242. FT_UInt glyph_index,
  2243. FT_Pointer buffer,
  2244. FT_UInt buffer_max );
  2245. /*************************************************************************/
  2246. /* */
  2247. /* <Function> */
  2248. /* FT_Get_Postscript_Name */
  2249. /* */
  2250. /* <Description> */
  2251. /* Retrieves the ASCII Postscript name of a given face, if available. */
  2252. /* This should only work with Postscript and TrueType fonts. */
  2253. /* */
  2254. /* <Input> */
  2255. /* face :: A handle to the source face object. */
  2256. /* */
  2257. /* <Return> */
  2258. /* A pointer to the face's Postscript name. NULL if un-available. */
  2259. /* */
  2260. /* <Note> */
  2261. /* The returned pointer is owned by the face and will be destroyed */
  2262. /* with it. */
  2263. /* */
  2264. FT_EXPORT( const char* )
  2265. FT_Get_Postscript_Name( FT_Face face );
  2266. /*************************************************************************/
  2267. /* */
  2268. /* <Function> */
  2269. /* FT_Select_Charmap */
  2270. /* */
  2271. /* <Description> */
  2272. /* Selects a given charmap by its encoding tag (as listed in */
  2273. /* `freetype.h'). */
  2274. /* */
  2275. /* <InOut> */
  2276. /* face :: A handle to the source face object. */
  2277. /* */
  2278. /* <Input> */
  2279. /* encoding :: A handle to the selected charmap. */
  2280. /* */
  2281. /* <Return> */
  2282. /* FreeType error code. 0 means success. */
  2283. /* */
  2284. /* <Note> */
  2285. /* This function will return an error if no charmap in the face */
  2286. /* corresponds to the encoding queried here. */
  2287. /* */
  2288. FT_EXPORT( FT_Error )
  2289. FT_Select_Charmap( FT_Face face,
  2290. FT_Encoding encoding );
  2291. /*************************************************************************/
  2292. /* */
  2293. /* <Function> */
  2294. /* FT_Set_Charmap */
  2295. /* */
  2296. /* <Description> */
  2297. /* Selects a given charmap for character code to glyph index */
  2298. /* decoding. */
  2299. /* */
  2300. /* <InOut> */
  2301. /* face :: A handle to the source face object. */
  2302. /* */
  2303. /* <Input> */
  2304. /* charmap :: A handle to the selected charmap. */
  2305. /* */
  2306. /* <Return> */
  2307. /* FreeType error code. 0 means success. */
  2308. /* */
  2309. /* <Note> */
  2310. /* This function will return an error if the charmap is not part of */
  2311. /* the face (i.e., if it is not listed in the face->charmaps[] */
  2312. /* table). */
  2313. /* */
  2314. FT_EXPORT( FT_Error )
  2315. FT_Set_Charmap( FT_Face face,
  2316. FT_CharMap charmap );
  2317. /*************************************************************************/
  2318. /* */
  2319. /* <Function> */
  2320. /* FT_Get_Char_Index */
  2321. /* */
  2322. /* <Description> */
  2323. /* Returns the glyph index of a given character code. This function */
  2324. /* uses a charmap object to do the translation. */
  2325. /* */
  2326. /* <Input> */
  2327. /* face :: A handle to the source face object. */
  2328. /* */
  2329. /* charcode :: The character code. */
  2330. /* */
  2331. /* <Return> */
  2332. /* The glyph index. 0 means `undefined character code'. */
  2333. /* */
  2334. /* <Note> */
  2335. /* FreeType computes its own glyph indices which are not necessarily */
  2336. /* the same as used in the font in case the font is based on glyph */
  2337. /* indices. Reason for this behaviour is to assure that index 0 is */
  2338. /* never used, representing the missing glyph. */
  2339. /* */
  2340. FT_EXPORT( FT_UInt )
  2341. FT_Get_Char_Index( FT_Face face,
  2342. FT_ULong charcode );
  2343. /*************************************************************************/
  2344. /* */
  2345. /* <Function> */
  2346. /* FT_Get_First_Char */
  2347. /* */
  2348. /* <Description> */
  2349. /* This function is used to return the first character code in the */
  2350. /* current charmap of a given face. It will also return the */
  2351. /* corresponding glyph index. */
  2352. /* */
  2353. /* <Input> */
  2354. /* face :: A handle to the source face object. */
  2355. /* */
  2356. /* <Output> */
  2357. /* agindex :: Glyph index of first character code. 0 if charmap is */
  2358. /* empty. */
  2359. /* */
  2360. /* <Return> */
  2361. /* The charmap's first character code. */
  2362. /* */
  2363. /* <Note> */
  2364. /* You should use this function with @FT_Get_Next_Char to be able to */
  2365. /* parse all character codes available in a given charmap. The code */
  2366. /* should look like this: */
  2367. /* */
  2368. /* { */
  2369. /* FT_ULong charcode; */
  2370. /* FT_UInt gindex; */
  2371. /* */
  2372. /* */
  2373. /* charcode = FT_Get_First_Char( face, &gindex ); */
  2374. /* while ( gindex != 0 ) */
  2375. /* { */
  2376. /* ... do something with (charcode,gindex) pair ... */
  2377. /* */
  2378. /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
  2379. /* } */
  2380. /* } */
  2381. /* */
  2382. /* Note that `*agindex' will be set to 0 if the charmap is empty. */
  2383. /* The result itself can be 0 in two cases: if the charmap is empty */
  2384. /* or when the value 0 is the first valid character code. */
  2385. /* */
  2386. FT_EXPORT( FT_ULong )
  2387. FT_Get_First_Char( FT_Face face,
  2388. FT_UInt *agindex );
  2389. /*************************************************************************/
  2390. /* */
  2391. /* <Function> */
  2392. /* FT_Get_Next_Char */
  2393. /* */
  2394. /* <Description> */
  2395. /* This function is used to return the next character code in the */
  2396. /* current charmap of a given face following the value 'char_code', */
  2397. /* as well as the corresponding glyph index. */
  2398. /* */
  2399. /* <Input> */
  2400. /* face :: A handle to the source face object. */
  2401. /* char_code :: The starting character code. */
  2402. /* */
  2403. /* <Output> */
  2404. /* agindex :: Glyph index of first character code. 0 if charmap */
  2405. /* is empty. */
  2406. /* */
  2407. /* <Return> */
  2408. /* The charmap's next character code. */
  2409. /* */
  2410. /* <Note> */
  2411. /* You should use this function with @FT_Get_First_Char to walk */
  2412. /* through all character codes available in a given charmap. See */
  2413. /* the note for this function for a simple code example. */
  2414. /* */
  2415. /* Note that `*agindex' will be set to 0 when there are no more codes */
  2416. /* in the charmap. */
  2417. /* */
  2418. FT_EXPORT( FT_ULong )
  2419. FT_Get_Next_Char( FT_Face face,
  2420. FT_ULong char_code,
  2421. FT_UInt *agindex );
  2422. /*************************************************************************/
  2423. /* */
  2424. /* <Function> */
  2425. /* FT_Get_Name_Index */
  2426. /* */
  2427. /* <Description> */
  2428. /* Returns the glyph index of a given glyph name. This function uses */
  2429. /* driver specific objects to do the translation. */
  2430. /* */
  2431. /* <Input> */
  2432. /* face :: A handle to the source face object. */
  2433. /* */
  2434. /* glyph_name :: The glyph name. */
  2435. /* */
  2436. /* <Return> */
  2437. /* The glyph index. 0 means `undefined character code'. */
  2438. /* */
  2439. FT_EXPORT( FT_UInt )
  2440. FT_Get_Name_Index( FT_Face face,
  2441. FT_String* glyph_name );
  2442. /*************************************************************************/
  2443. /* */
  2444. /* <Section> */
  2445. /* computations */
  2446. /* */
  2447. /* <Title> */
  2448. /* Computations */
  2449. /* */
  2450. /* <Abstract> */
  2451. /* Crunching fixed numbers and vectors */
  2452. /* */
  2453. /* <Description> */
  2454. /* This section contains various functions used to perform */
  2455. /* computations on 16.16 fixed-float numbers or 2d vectors. */
  2456. /* */
  2457. /* <Order> */
  2458. /* FT_MulDiv */
  2459. /* FT_MulFix */
  2460. /* FT_DivFix */
  2461. /* FT_RoundFix */
  2462. /* FT_CeilFix */
  2463. /* FT_FloorFix */
  2464. /* FT_Vector_Transform */
  2465. /* FT_Matrix_Multiply */
  2466. /* FT_Matrix_Invert */
  2467. /* */
  2468. /*************************************************************************/
  2469. /*************************************************************************/
  2470. /* */
  2471. /* <Function> */
  2472. /* FT_MulDiv */
  2473. /* */
  2474. /* <Description> */
  2475. /* A very simple function used to perform the computation `(a*b)/c' */
  2476. /* with maximal accuracy (it uses a 64-bit intermediate integer */
  2477. /* whenever necessary). */
  2478. /* */
  2479. /* This function isn't necessarily as fast as some processor specific */
  2480. /* operations, but is at least completely portable. */
  2481. /* */
  2482. /* <Input> */
  2483. /* a :: The first multiplier. */
  2484. /* b :: The second multiplier. */
  2485. /* c :: The divisor. */
  2486. /* */
  2487. /* <Return> */
  2488. /* The result of `(a*b)/c'. This function never traps when trying to */
  2489. /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
  2490. /* on the signs of `a' and `b'. */
  2491. /* */
  2492. FT_EXPORT( FT_Long )
  2493. FT_MulDiv( FT_Long a,
  2494. FT_Long b,
  2495. FT_Long c );
  2496. /*************************************************************************/
  2497. /* */
  2498. /* <Function> */
  2499. /* FT_MulFix */
  2500. /* */
  2501. /* <Description> */
  2502. /* A very simple function used to perform the computation */
  2503. /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
  2504. /* used to multiply a given value by a 16.16 fixed float factor. */
  2505. /* */
  2506. /* <Input> */
  2507. /* a :: The first multiplier. */
  2508. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  2509. /* possible (see note below). */
  2510. /* */
  2511. /* <Return> */
  2512. /* The result of `(a*b)/0x10000'. */
  2513. /* */
  2514. /* <Note> */
  2515. /* This function has been optimized for the case where the absolute */
  2516. /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
  2517. /* As this happens mainly when scaling from notional units to */
  2518. /* fractional pixels in FreeType, it resulted in noticeable speed */
  2519. /* improvements between versions 2.x and 1.x. */
  2520. /* */
  2521. /* As a conclusion, always try to place a 16.16 factor as the */
  2522. /* _second_ argument of this function; this can make a great */
  2523. /* difference. */
  2524. /* */
  2525. FT_EXPORT( FT_Long )
  2526. FT_MulFix( FT_Long a,
  2527. FT_Long b );
  2528. /*************************************************************************/
  2529. /* */
  2530. /* <Function> */
  2531. /* FT_DivFix */
  2532. /* */
  2533. /* <Description> */
  2534. /* A very simple function used to perform the computation */
  2535. /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
  2536. /* used to divide a given value by a 16.16 fixed float factor. */
  2537. /* */
  2538. /* <Input> */
  2539. /* a :: The first multiplier. */
  2540. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  2541. /* possible (see note below). */
  2542. /* */
  2543. /* <Return> */
  2544. /* The result of `(a*0x10000)/b'. */
  2545. /* */
  2546. /* <Note> */
  2547. /* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
  2548. /* 32 bits, then the division is computed directly. Otherwise, we */
  2549. /* use a specialized version of the old @FT_MulDiv64. */
  2550. /* */
  2551. FT_EXPORT( FT_Long )
  2552. FT_DivFix( FT_Long a,
  2553. FT_Long b );
  2554. /*************************************************************************/
  2555. /* */
  2556. /* <Function> */
  2557. /* FT_RoundFix */
  2558. /* */
  2559. /* <Description> */
  2560. /* A very simple function used to round a 16.16 fixed number. */
  2561. /* */
  2562. /* <Input> */
  2563. /* a :: The number to be rounded. */
  2564. /* */
  2565. /* <Return> */
  2566. /* The result of `(a + 0x8000) & -0x10000'. */
  2567. /* */
  2568. FT_EXPORT( FT_Fixed )
  2569. FT_RoundFix( FT_Fixed a );
  2570. /*************************************************************************/
  2571. /* */
  2572. /* <Function> */
  2573. /* FT_CeilFix */
  2574. /* */
  2575. /* <Description> */
  2576. /* A very simple function used to compute the ceiling function of a */
  2577. /* 16.16 fixed number. */
  2578. /* */
  2579. /* <Input> */
  2580. /* a :: The number for which the ceiling function is to be computed. */
  2581. /* */
  2582. /* <Return> */
  2583. /* The result of `(a + 0x10000 - 1) & -0x10000'. */
  2584. /* */
  2585. FT_EXPORT( FT_Fixed )
  2586. FT_CeilFix( FT_Fixed a );
  2587. /*************************************************************************/
  2588. /* */
  2589. /* <Function> */
  2590. /* FT_FloorFix */
  2591. /* */
  2592. /* <Description> */
  2593. /* A very simple function used to compute the floor function of a */
  2594. /* 16.16 fixed number. */
  2595. /* */
  2596. /* <Input> */
  2597. /* a :: The number for which the floor function is to be computed. */
  2598. /* */
  2599. /* <Return> */
  2600. /* The result of `a & -0x10000'. */
  2601. /* */
  2602. FT_EXPORT( FT_Fixed )
  2603. FT_FloorFix( FT_Fixed a );
  2604. /*************************************************************************/
  2605. /* */
  2606. /* <Function> */
  2607. /* FT_Vector_Transform */
  2608. /* */
  2609. /* <Description> */
  2610. /* Transforms a single vector through a 2x2 matrix. */
  2611. /* */
  2612. /* <InOut> */
  2613. /* vector :: The target vector to transform. */
  2614. /* */
  2615. /* <Input> */
  2616. /* matrix :: A pointer to the source 2x2 matrix. */
  2617. /* */
  2618. /* <Note> */
  2619. /* The result is undefined if either `vector' or `matrix' is invalid. */
  2620. /* */
  2621. FT_EXPORT( void )
  2622. FT_Vector_Transform( FT_Vector* vec,
  2623. FT_Matrix* matrix );
  2624. /* */
  2625. FT_END_HEADER
  2626. #endif /* __FREETYPE_H__ */
  2627. /* END */