freetype.h 206 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434
  1. /***************************************************************************/
  2. /* */
  3. /* freetype.h */
  4. /* */
  5. /* FreeType high-level API and common types (specification only). */
  6. /* */
  7. /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 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 FT_FREETYPE_H
  18. #error "`ft2build.h' hasn't been included yet!"
  19. #error "Please always use macros to include FreeType header files."
  20. #error "Example:"
  21. #error " #include <ft2build.h>"
  22. #error " #include FT_FREETYPE_H"
  23. #endif
  24. /*************************************************************************/
  25. /* */
  26. /* The `raster' component duplicates some of the declarations in */
  27. /* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */
  28. /* */
  29. /*************************************************************************/
  30. #ifndef __FREETYPE_H__
  31. #define __FREETYPE_H__
  32. #include <ft2build.h>
  33. #include FT_CONFIG_CONFIG_H
  34. #include FT_ERRORS_H
  35. #include FT_TYPES_H
  36. FT_BEGIN_HEADER
  37. /*************************************************************************/
  38. /* */
  39. /* <Section> */
  40. /* user_allocation */
  41. /* */
  42. /* <Title> */
  43. /* User allocation */
  44. /* */
  45. /* <Abstract> */
  46. /* How client applications should allocate FreeType data structures. */
  47. /* */
  48. /* <Description> */
  49. /* FreeType assumes that structures allocated by the user and passed */
  50. /* as arguments are zeroed out except for the actual data. With */
  51. /* other words, it is recommended to use `calloc' (or variants of it) */
  52. /* instead of `malloc' for allocation. */
  53. /* */
  54. /*************************************************************************/
  55. /*************************************************************************/
  56. /*************************************************************************/
  57. /* */
  58. /* B A S I C T Y P E S */
  59. /* */
  60. /*************************************************************************/
  61. /*************************************************************************/
  62. /*************************************************************************/
  63. /* */
  64. /* <Section> */
  65. /* base_interface */
  66. /* */
  67. /* <Title> */
  68. /* Base Interface */
  69. /* */
  70. /* <Abstract> */
  71. /* The FreeType 2 base font interface. */
  72. /* */
  73. /* <Description> */
  74. /* This section describes the public high-level API of FreeType 2. */
  75. /* */
  76. /* <Order> */
  77. /* FT_Library */
  78. /* FT_Face */
  79. /* FT_Size */
  80. /* FT_GlyphSlot */
  81. /* FT_CharMap */
  82. /* FT_Encoding */
  83. /* */
  84. /* FT_FaceRec */
  85. /* */
  86. /* FT_FACE_FLAG_SCALABLE */
  87. /* FT_FACE_FLAG_FIXED_SIZES */
  88. /* FT_FACE_FLAG_FIXED_WIDTH */
  89. /* FT_FACE_FLAG_HORIZONTAL */
  90. /* FT_FACE_FLAG_VERTICAL */
  91. /* FT_FACE_FLAG_SFNT */
  92. /* FT_FACE_FLAG_KERNING */
  93. /* FT_FACE_FLAG_MULTIPLE_MASTERS */
  94. /* FT_FACE_FLAG_GLYPH_NAMES */
  95. /* FT_FACE_FLAG_EXTERNAL_STREAM */
  96. /* FT_FACE_FLAG_FAST_GLYPHS */
  97. /* FT_FACE_FLAG_HINTER */
  98. /* */
  99. /* FT_STYLE_FLAG_BOLD */
  100. /* FT_STYLE_FLAG_ITALIC */
  101. /* */
  102. /* FT_SizeRec */
  103. /* FT_Size_Metrics */
  104. /* */
  105. /* FT_GlyphSlotRec */
  106. /* FT_Glyph_Metrics */
  107. /* FT_SubGlyph */
  108. /* */
  109. /* FT_Bitmap_Size */
  110. /* */
  111. /* FT_Init_FreeType */
  112. /* FT_Done_FreeType */
  113. /* */
  114. /* FT_New_Face */
  115. /* FT_Done_Face */
  116. /* FT_New_Memory_Face */
  117. /* FT_Open_Face */
  118. /* FT_Open_Args */
  119. /* FT_Parameter */
  120. /* FT_Attach_File */
  121. /* FT_Attach_Stream */
  122. /* */
  123. /* FT_Set_Char_Size */
  124. /* FT_Set_Pixel_Sizes */
  125. /* FT_Request_Size */
  126. /* FT_Select_Size */
  127. /* FT_Size_Request_Type */
  128. /* FT_Size_Request */
  129. /* FT_Set_Transform */
  130. /* FT_Load_Glyph */
  131. /* FT_Get_Char_Index */
  132. /* FT_Get_Name_Index */
  133. /* FT_Load_Char */
  134. /* */
  135. /* FT_OPEN_MEMORY */
  136. /* FT_OPEN_STREAM */
  137. /* FT_OPEN_PATHNAME */
  138. /* FT_OPEN_DRIVER */
  139. /* FT_OPEN_PARAMS */
  140. /* */
  141. /* FT_LOAD_DEFAULT */
  142. /* FT_LOAD_RENDER */
  143. /* FT_LOAD_MONOCHROME */
  144. /* FT_LOAD_LINEAR_DESIGN */
  145. /* FT_LOAD_NO_SCALE */
  146. /* FT_LOAD_NO_HINTING */
  147. /* FT_LOAD_NO_BITMAP */
  148. /* FT_LOAD_CROP_BITMAP */
  149. /* */
  150. /* FT_LOAD_VERTICAL_LAYOUT */
  151. /* FT_LOAD_IGNORE_TRANSFORM */
  152. /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
  153. /* FT_LOAD_FORCE_AUTOHINT */
  154. /* FT_LOAD_NO_RECURSE */
  155. /* FT_LOAD_PEDANTIC */
  156. /* */
  157. /* FT_LOAD_TARGET_NORMAL */
  158. /* FT_LOAD_TARGET_LIGHT */
  159. /* FT_LOAD_TARGET_MONO */
  160. /* FT_LOAD_TARGET_LCD */
  161. /* FT_LOAD_TARGET_LCD_V */
  162. /* */
  163. /* FT_Render_Glyph */
  164. /* FT_Render_Mode */
  165. /* FT_Get_Kerning */
  166. /* FT_Kerning_Mode */
  167. /* FT_Get_Track_Kerning */
  168. /* FT_Get_Glyph_Name */
  169. /* FT_Get_Postscript_Name */
  170. /* */
  171. /* FT_CharMapRec */
  172. /* FT_Select_Charmap */
  173. /* FT_Set_Charmap */
  174. /* FT_Get_Charmap_Index */
  175. /* */
  176. /*************************************************************************/
  177. /*************************************************************************/
  178. /* */
  179. /* <Struct> */
  180. /* FT_Glyph_Metrics */
  181. /* */
  182. /* <Description> */
  183. /* A structure used to model the metrics of a single glyph. The */
  184. /* values are expressed in 26.6 fractional pixel format; if the flag */
  185. /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
  186. /* are expressed in font units instead. */
  187. /* */
  188. /* <Fields> */
  189. /* width :: */
  190. /* The glyph's width. */
  191. /* */
  192. /* height :: */
  193. /* The glyph's height. */
  194. /* */
  195. /* horiBearingX :: */
  196. /* Left side bearing for horizontal layout. */
  197. /* */
  198. /* horiBearingY :: */
  199. /* Top side bearing for horizontal layout. */
  200. /* */
  201. /* horiAdvance :: */
  202. /* Advance width for horizontal layout. */
  203. /* */
  204. /* vertBearingX :: */
  205. /* Left side bearing for vertical layout. */
  206. /* */
  207. /* vertBearingY :: */
  208. /* Top side bearing for vertical layout. */
  209. /* */
  210. /* vertAdvance :: */
  211. /* Advance height for vertical layout. */
  212. /* */
  213. typedef struct FT_Glyph_Metrics_
  214. {
  215. FT_Pos width;
  216. FT_Pos height;
  217. FT_Pos horiBearingX;
  218. FT_Pos horiBearingY;
  219. FT_Pos horiAdvance;
  220. FT_Pos vertBearingX;
  221. FT_Pos vertBearingY;
  222. FT_Pos vertAdvance;
  223. } FT_Glyph_Metrics;
  224. /*************************************************************************/
  225. /* */
  226. /* <Struct> */
  227. /* FT_Bitmap_Size */
  228. /* */
  229. /* <Description> */
  230. /* This structure models the metrics of a bitmap strike (i.e., a set */
  231. /* of glyphs for a given point size and resolution) in a bitmap font. */
  232. /* It is used for the `available_sizes' field of @FT_Face. */
  233. /* */
  234. /* <Fields> */
  235. /* height :: The vertical distance, in pixels, between two */
  236. /* consecutive baselines. It is always positive. */
  237. /* */
  238. /* width :: The average width, in pixels, of all glyphs in the */
  239. /* strike. */
  240. /* */
  241. /* size :: The nominal size of the strike in 26.6 fractional */
  242. /* points. This field is not very useful. */
  243. /* */
  244. /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
  245. /* pixels. */
  246. /* */
  247. /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
  248. /* pixels. */
  249. /* */
  250. /* <Note> */
  251. /* Windows FNT: */
  252. /* The nominal size given in a FNT font is not reliable. Thus when */
  253. /* the driver finds it incorrect, it sets `size' to some calculated */
  254. /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
  255. /* height given in the font, respectively. */
  256. /* */
  257. /* TrueType embedded bitmaps: */
  258. /* `size', `width', and `height' values are not contained in the */
  259. /* bitmap strike itself. They are computed from the global font */
  260. /* parameters. */
  261. /* */
  262. typedef struct FT_Bitmap_Size_
  263. {
  264. FT_Short height;
  265. FT_Short width;
  266. FT_Pos size;
  267. FT_Pos x_ppem;
  268. FT_Pos y_ppem;
  269. } FT_Bitmap_Size;
  270. /*************************************************************************/
  271. /*************************************************************************/
  272. /* */
  273. /* O B J E C T C L A S S E S */
  274. /* */
  275. /*************************************************************************/
  276. /*************************************************************************/
  277. /*************************************************************************/
  278. /* */
  279. /* <Type> */
  280. /* FT_Library */
  281. /* */
  282. /* <Description> */
  283. /* A handle to a FreeType library instance. Each `library' is */
  284. /* completely independent from the others; it is the `root' of a set */
  285. /* of objects like fonts, faces, sizes, etc. */
  286. /* */
  287. /* It also embeds a memory manager (see @FT_Memory), as well as a */
  288. /* scan-line converter object (see @FT_Raster). */
  289. /* */
  290. /* For multi-threading applications each thread should have its own */
  291. /* FT_Library object. */
  292. /* */
  293. /* <Note> */
  294. /* Library objects are normally created by @FT_Init_FreeType, and */
  295. /* destroyed with @FT_Done_FreeType. */
  296. /* */
  297. typedef struct FT_LibraryRec_ *FT_Library;
  298. /*************************************************************************/
  299. /* */
  300. /* <Type> */
  301. /* FT_Module */
  302. /* */
  303. /* <Description> */
  304. /* A handle to a given FreeType module object. Each module can be a */
  305. /* font driver, a renderer, or anything else that provides services */
  306. /* to the formers. */
  307. /* */
  308. typedef struct FT_ModuleRec_* FT_Module;
  309. /*************************************************************************/
  310. /* */
  311. /* <Type> */
  312. /* FT_Driver */
  313. /* */
  314. /* <Description> */
  315. /* A handle to a given FreeType font driver object. Each font driver */
  316. /* is a special module capable of creating faces from font files. */
  317. /* */
  318. typedef struct FT_DriverRec_* FT_Driver;
  319. /*************************************************************************/
  320. /* */
  321. /* <Type> */
  322. /* FT_Renderer */
  323. /* */
  324. /* <Description> */
  325. /* A handle to a given FreeType renderer. A renderer is a special */
  326. /* module in charge of converting a glyph image to a bitmap, when */
  327. /* necessary. Each renderer supports a given glyph image format, and */
  328. /* one or more target surface depths. */
  329. /* */
  330. typedef struct FT_RendererRec_* FT_Renderer;
  331. /*************************************************************************/
  332. /* */
  333. /* <Type> */
  334. /* FT_Face */
  335. /* */
  336. /* <Description> */
  337. /* A handle to a given typographic face object. A face object models */
  338. /* a given typeface, in a given style. */
  339. /* */
  340. /* <Note> */
  341. /* Each face object also owns a single @FT_GlyphSlot object, as well */
  342. /* as one or more @FT_Size objects. */
  343. /* */
  344. /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
  345. /* a given filepathname or a custom input stream. */
  346. /* */
  347. /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
  348. /* */
  349. /* <Also> */
  350. /* The @FT_FaceRec details the publicly accessible fields of a given */
  351. /* face object. */
  352. /* */
  353. typedef struct FT_FaceRec_* FT_Face;
  354. /*************************************************************************/
  355. /* */
  356. /* <Type> */
  357. /* FT_Size */
  358. /* */
  359. /* <Description> */
  360. /* A handle to an object used to model a face scaled to a given */
  361. /* character size. */
  362. /* */
  363. /* <Note> */
  364. /* Each @FT_Face has an _active_ @FT_Size object that is used by */
  365. /* functions like @FT_Load_Glyph to determine the scaling */
  366. /* transformation which is used to load and hint glyphs and metrics. */
  367. /* */
  368. /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
  369. /* @FT_Request_Size or even @FT_Select_Size to change the content */
  370. /* (i.e., the scaling values) of the active @FT_Size. */
  371. /* */
  372. /* You can use @FT_New_Size to create additional size objects for a */
  373. /* given @FT_Face, but they won't be used by other functions until */
  374. /* you activate it through @FT_Activate_Size. Only one size can be */
  375. /* activated at any given time per face. */
  376. /* */
  377. /* <Also> */
  378. /* The @FT_SizeRec structure details the publicly accessible fields */
  379. /* of a given size object. */
  380. /* */
  381. typedef struct FT_SizeRec_* FT_Size;
  382. /*************************************************************************/
  383. /* */
  384. /* <Type> */
  385. /* FT_GlyphSlot */
  386. /* */
  387. /* <Description> */
  388. /* A handle to a given `glyph slot'. A slot is a container where it */
  389. /* is possible to load any one of the glyphs contained in its parent */
  390. /* face. */
  391. /* */
  392. /* In other words, each time you call @FT_Load_Glyph or */
  393. /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
  394. /* i.e., the glyph's metrics, its image (bitmap or outline), and */
  395. /* other control information. */
  396. /* */
  397. /* <Also> */
  398. /* @FT_GlyphSlotRec details the publicly accessible glyph fields. */
  399. /* */
  400. typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
  401. /*************************************************************************/
  402. /* */
  403. /* <Type> */
  404. /* FT_CharMap */
  405. /* */
  406. /* <Description> */
  407. /* A handle to a given character map. A charmap is used to translate */
  408. /* character codes in a given encoding into glyph indexes for its */
  409. /* parent's face. Some font formats may provide several charmaps per */
  410. /* font. */
  411. /* */
  412. /* Each face object owns zero or more charmaps, but only one of them */
  413. /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
  414. /* */
  415. /* The list of available charmaps in a face is available through the */
  416. /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
  417. /* */
  418. /* The currently active charmap is available as `face->charmap'. */
  419. /* You should call @FT_Set_Charmap to change it. */
  420. /* */
  421. /* <Note> */
  422. /* When a new face is created (either through @FT_New_Face or */
  423. /* @FT_Open_Face), the library looks for a Unicode charmap within */
  424. /* the list and automatically activates it. */
  425. /* */
  426. /* <Also> */
  427. /* The @FT_CharMapRec details the publicly accessible fields of a */
  428. /* given character map. */
  429. /* */
  430. typedef struct FT_CharMapRec_* FT_CharMap;
  431. /*************************************************************************/
  432. /* */
  433. /* <Macro> */
  434. /* FT_ENC_TAG */
  435. /* */
  436. /* <Description> */
  437. /* This macro converts four-letter tags into an unsigned long. It is */
  438. /* used to define `encoding' identifiers (see @FT_Encoding). */
  439. /* */
  440. /* <Note> */
  441. /* Since many 16bit compilers don't like 32bit enumerations, you */
  442. /* should redefine this macro in case of problems to something like */
  443. /* this: */
  444. /* */
  445. /* { */
  446. /* #define FT_ENC_TAG( value, a, b, c, d ) value */
  447. /* } */
  448. /* */
  449. /* to get a simple enumeration without assigning special numbers. */
  450. /* */
  451. #ifndef FT_ENC_TAG
  452. #define FT_ENC_TAG( value, a, b, c, d ) \
  453. value = ( ( (FT_UInt32)(a) << 24 ) | \
  454. ( (FT_UInt32)(b) << 16 ) | \
  455. ( (FT_UInt32)(c) << 8 ) | \
  456. (FT_UInt32)(d) )
  457. #endif /* FT_ENC_TAG */
  458. /*************************************************************************/
  459. /* */
  460. /* <Enum> */
  461. /* FT_Encoding */
  462. /* */
  463. /* <Description> */
  464. /* An enumeration used to specify character sets supported by */
  465. /* charmaps. Used in the @FT_Select_Charmap API function. */
  466. /* */
  467. /* <Note> */
  468. /* Despite the name, this enumeration lists specific character */
  469. /* repertories (i.e., charsets), and not text encoding methods (e.g., */
  470. /* UTF-8, UTF-16, GB2312_EUC, etc.). */
  471. /* */
  472. /* Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */
  473. /* all character codes must be expressed as FT_Longs. */
  474. /* */
  475. /* Other encodings might be defined in the future. */
  476. /* */
  477. /* <Values> */
  478. /* FT_ENCODING_NONE :: */
  479. /* The encoding value 0 is reserved. */
  480. /* */
  481. /* FT_ENCODING_UNICODE :: */
  482. /* Corresponds to the Unicode character set. This value covers */
  483. /* all versions of the Unicode repertoire, including ASCII and */
  484. /* Latin-1. Most fonts include a Unicode charmap, but not all */
  485. /* of them. */
  486. /* */
  487. /* FT_ENCODING_MS_SYMBOL :: */
  488. /* Corresponds to the Microsoft Symbol encoding, used to encode */
  489. /* mathematical symbols in the 32..255 character code range. For */
  490. /* more information, see `http://www.ceviz.net/symbol.htm'. */
  491. /* */
  492. /* FT_ENCODING_SJIS :: */
  493. /* Corresponds to Japanese SJIS encoding. More info at */
  494. /* at `http://langsupport.japanreference.com/encoding.shtml'. */
  495. /* See note on multi-byte encodings below. */
  496. /* */
  497. /* FT_ENCODING_GB2312 :: */
  498. /* Corresponds to an encoding system for Simplified Chinese as used */
  499. /* used in mainland China. */
  500. /* */
  501. /* FT_ENCODING_BIG5 :: */
  502. /* Corresponds to an encoding system for Traditional Chinese as used */
  503. /* in Taiwan and Hong Kong. */
  504. /* */
  505. /* FT_ENCODING_WANSUNG :: */
  506. /* Corresponds to the Korean encoding system known as Wansung. */
  507. /* For more information see */
  508. /* `http://www.microsoft.com/typography/unicode/949.txt'. */
  509. /* */
  510. /* FT_ENCODING_JOHAB :: */
  511. /* The Korean standard character set (KS C-5601-1992), which */
  512. /* corresponds to MS Windows code page 1361. This character set */
  513. /* includes all possible Hangeul character combinations. */
  514. /* */
  515. /* FT_ENCODING_ADOBE_LATIN_1 :: */
  516. /* Corresponds to a Latin-1 encoding as defined in a Type 1 */
  517. /* Postscript font. It is limited to 256 character codes. */
  518. /* */
  519. /* FT_ENCODING_ADOBE_STANDARD :: */
  520. /* Corresponds to the Adobe Standard encoding, as found in Type 1, */
  521. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  522. /* codes. */
  523. /* */
  524. /* FT_ENCODING_ADOBE_EXPERT :: */
  525. /* Corresponds to the Adobe Expert encoding, as found in Type 1, */
  526. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  527. /* codes. */
  528. /* */
  529. /* FT_ENCODING_ADOBE_CUSTOM :: */
  530. /* Corresponds to a custom encoding, as found in Type 1, CFF, and */
  531. /* OpenType/CFF fonts. It is limited to 256 character codes. */
  532. /* */
  533. /* FT_ENCODING_APPLE_ROMAN :: */
  534. /* Corresponds to the 8-bit Apple roman encoding. Many TrueType and */
  535. /* OpenType fonts contain a charmap for this encoding, since older */
  536. /* versions of Mac OS are able to use it. */
  537. /* */
  538. /* FT_ENCODING_OLD_LATIN_2 :: */
  539. /* This value is deprecated and was never used nor reported by */
  540. /* FreeType. Don't use or test for it. */
  541. /* */
  542. /* FT_ENCODING_MS_SJIS :: */
  543. /* Same as FT_ENCODING_SJIS. Deprecated. */
  544. /* */
  545. /* FT_ENCODING_MS_GB2312 :: */
  546. /* Same as FT_ENCODING_GB2312. Deprecated. */
  547. /* */
  548. /* FT_ENCODING_MS_BIG5 :: */
  549. /* Same as FT_ENCODING_BIG5. Deprecated. */
  550. /* */
  551. /* FT_ENCODING_MS_WANSUNG :: */
  552. /* Same as FT_ENCODING_WANSUNG. Deprecated. */
  553. /* */
  554. /* FT_ENCODING_MS_JOHAB :: */
  555. /* Same as FT_ENCODING_JOHAB. Deprecated. */
  556. /* */
  557. /* <Note> */
  558. /* By default, FreeType automatically synthetizes a Unicode charmap */
  559. /* for Postscript fonts, using their glyph names dictionaries. */
  560. /* However, it also reports the encodings defined explicitly in the */
  561. /* font file, for the cases when they are needed, with the Adobe */
  562. /* values as well. */
  563. /* */
  564. /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
  565. /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
  566. /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out which */
  567. /* encoding is really present. If, for example, the `cs_registry' */
  568. /* field is `KOI8' and the `cs_encoding' field is `R', the font is */
  569. /* encoded in KOI8-R. */
  570. /* */
  571. /* FT_ENCODING_NONE is always set (with a single exception) by the */
  572. /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
  573. /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
  574. /* which encoding is really present. For example, */
  575. /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
  576. /* Russian). */
  577. /* */
  578. /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
  579. /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
  580. /* FT_ENCODING_APPLE_ROMAN). */
  581. /* */
  582. /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function c */
  583. /* @FT_Get_CMap_Language_ID to query the Mac language ID which may be */
  584. /* needed to be able to distinguish Apple encoding variants. See */
  585. /* */
  586. /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
  587. /* */
  588. /* to get an idea how to do that. Basically, if the language ID is 0, */
  589. /* don't use it, otherwise subtract 1 from the language ID. Then */
  590. /* examine `encoding_id'. If, for example, `encoding_id' is */
  591. /* @TT_MAC_ID_ROMAN and the language ID (minus 1) is */
  592. /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
  593. /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
  594. /* variant the Arabic encoding. */
  595. /* */
  596. typedef enum FT_Encoding_
  597. {
  598. FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
  599. FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
  600. FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
  601. FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
  602. FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
  603. FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
  604. FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
  605. FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
  606. /* for backwards compatibility */
  607. FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
  608. FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
  609. FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
  610. FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
  611. FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
  612. FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
  613. FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
  614. FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
  615. FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
  616. FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
  617. FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
  618. } FT_Encoding;
  619. /*************************************************************************/
  620. /* */
  621. /* <Enum> */
  622. /* ft_encoding_xxx */
  623. /* */
  624. /* <Description> */
  625. /* These constants are deprecated; use the corresponding @FT_Encoding */
  626. /* values instead. */
  627. /* */
  628. #define ft_encoding_none FT_ENCODING_NONE
  629. #define ft_encoding_unicode FT_ENCODING_UNICODE
  630. #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
  631. #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
  632. #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
  633. #define ft_encoding_sjis FT_ENCODING_SJIS
  634. #define ft_encoding_gb2312 FT_ENCODING_GB2312
  635. #define ft_encoding_big5 FT_ENCODING_BIG5
  636. #define ft_encoding_wansung FT_ENCODING_WANSUNG
  637. #define ft_encoding_johab FT_ENCODING_JOHAB
  638. #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
  639. #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
  640. #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
  641. #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
  642. /*************************************************************************/
  643. /* */
  644. /* <Struct> */
  645. /* FT_CharMapRec */
  646. /* */
  647. /* <Description> */
  648. /* The base charmap structure. */
  649. /* */
  650. /* <Fields> */
  651. /* face :: A handle to the parent face object. */
  652. /* */
  653. /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
  654. /* this with @FT_Select_Charmap. */
  655. /* */
  656. /* platform_id :: An ID number describing the platform for the */
  657. /* following encoding ID. This comes directly from */
  658. /* the TrueType specification and should be emulated */
  659. /* for other formats. */
  660. /* */
  661. /* encoding_id :: A platform specific encoding number. This also */
  662. /* comes from the TrueType specification and should be */
  663. /* emulated similarly. */
  664. /* */
  665. typedef struct FT_CharMapRec_
  666. {
  667. FT_Face face;
  668. FT_Encoding encoding;
  669. FT_UShort platform_id;
  670. FT_UShort encoding_id;
  671. } FT_CharMapRec;
  672. /*************************************************************************/
  673. /*************************************************************************/
  674. /* */
  675. /* B A S E O B J E C T C L A S S E S */
  676. /* */
  677. /*************************************************************************/
  678. /*************************************************************************/
  679. /*************************************************************************/
  680. /* */
  681. /* <Type> */
  682. /* FT_Face_Internal */
  683. /* */
  684. /* <Description> */
  685. /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
  686. /* model private data of a given @FT_Face object. */
  687. /* */
  688. /* This structure might change between releases of FreeType 2 and is */
  689. /* not generally available to client applications. */
  690. /* */
  691. typedef struct FT_Face_InternalRec_* FT_Face_Internal;
  692. /*************************************************************************/
  693. /* */
  694. /* <Struct> */
  695. /* FT_FaceRec */
  696. /* */
  697. /* <Description> */
  698. /* FreeType root face class structure. A face object models a */
  699. /* typeface in a font file. */
  700. /* */
  701. /* <Fields> */
  702. /* num_faces :: The number of faces in the font file. Some */
  703. /* font formats can have multiple faces in */
  704. /* a font file. */
  705. /* */
  706. /* face_index :: The index of the face in the font file. It */
  707. /* is set to 0 if there is only one face in */
  708. /* the font file. */
  709. /* */
  710. /* face_flags :: A set of bit flags that give important */
  711. /* information about the face; see */
  712. /* @FT_FACE_FLAG_XXX for the details. */
  713. /* */
  714. /* style_flags :: A set of bit flags indicating the style of */
  715. /* the face; see @FT_STYLE_FLAG_XXX for the */
  716. /* details. */
  717. /* */
  718. /* num_glyphs :: The number of glyphs in the face. If the */
  719. /* face is scalable and has sbits (see */
  720. /* `num_fixed_sizes'), it is set to the number */
  721. /* of outline glyphs. */
  722. /* */
  723. /* family_name :: The face's family name. This is an ASCII */
  724. /* string, usually in English, which describes */
  725. /* the typeface's family (like `Times New */
  726. /* Roman', `Bodoni', `Garamond', etc). This */
  727. /* is a least common denominator used to list */
  728. /* fonts. Some formats (TrueType & OpenType) */
  729. /* provide localized and Unicode versions of */
  730. /* this string. Applications should use the */
  731. /* format specific interface to access them. */
  732. /* */
  733. /* style_name :: The face's style name. This is an ASCII */
  734. /* string, usually in English, which describes */
  735. /* the typeface's style (like `Italic', */
  736. /* `Bold', `Condensed', etc). Not all font */
  737. /* formats provide a style name, so this field */
  738. /* is optional, and can be set to NULL. As */
  739. /* for `family_name', some formats provide */
  740. /* localized and Unicode versions of this */
  741. /* string. Applications should use the format */
  742. /* specific interface to access them. */
  743. /* */
  744. /* num_fixed_sizes :: The number of bitmap strikes in the face. */
  745. /* Even if the face is scalable, there might */
  746. /* still be bitmap strikes, which are called */
  747. /* `sbits' in that case. */
  748. /* */
  749. /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
  750. /* strikes in the face. It is set to NULL if */
  751. /* there is no bitmap strike. */
  752. /* */
  753. /* num_charmaps :: The number of charmaps in the face. */
  754. /* */
  755. /* charmaps :: An array of the charmaps of the face. */
  756. /* */
  757. /* generic :: A field reserved for client uses. See the */
  758. /* @FT_Generic type description. */
  759. /* */
  760. /* bbox :: The font bounding box. Coordinates are */
  761. /* expressed in font units (see */
  762. /* `units_per_EM'). The box is large enough */
  763. /* to contain any glyph from the font. Thus, */
  764. /* `bbox.yMax' can be seen as the `maximal */
  765. /* ascender', and `bbox.yMin' as the `minimal */
  766. /* descender'. Only relevant for scalable */
  767. /* formats. */
  768. /* */
  769. /* units_per_EM :: The number of font units per EM square for */
  770. /* this face. This is typically 2048 for */
  771. /* TrueType fonts, and 1000 for Type 1 fonts. */
  772. /* Only relevant for scalable formats. */
  773. /* */
  774. /* ascender :: The typographic ascender of the face, */
  775. /* expressed in font units. For font formats */
  776. /* not having this information, it is set to */
  777. /* `bbox.yMax'. Only relevant for scalable */
  778. /* formats. */
  779. /* */
  780. /* descender :: The typographic descender of the face, */
  781. /* expressed in font units. For font formats */
  782. /* not having this information, it is set to */
  783. /* `bbox.yMin'. Note that this field is */
  784. /* usually negative. Only relevant for */
  785. /* scalable formats. */
  786. /* */
  787. /* height :: The height is the vertical distance */
  788. /* between two consecutive baselines, */
  789. /* expressed in font units. It is always */
  790. /* positive. Only relevant for scalable */
  791. /* formats. */
  792. /* */
  793. /* max_advance_width :: The maximal advance width, in font units, */
  794. /* for all glyphs in this face. This can be */
  795. /* used to make word wrapping computations */
  796. /* faster. Only relevant for scalable */
  797. /* formats. */
  798. /* */
  799. /* max_advance_height :: The maximal advance height, in font units, */
  800. /* for all glyphs in this face. This is only */
  801. /* relevant for vertical layouts, and is set */
  802. /* to `height' for fonts that do not provide */
  803. /* vertical metrics. Only relevant for */
  804. /* scalable formats. */
  805. /* */
  806. /* underline_position :: The position, in font units, of the */
  807. /* underline line for this face. It's the */
  808. /* center of the underlining stem. Only */
  809. /* relevant for scalable formats. */
  810. /* */
  811. /* underline_thickness :: The thickness, in font units, of the */
  812. /* underline for this face. Only relevant for */
  813. /* scalable formats. */
  814. /* */
  815. /* glyph :: The face's associated glyph slot(s). */
  816. /* */
  817. /* size :: The current active size for this face. */
  818. /* */
  819. /* charmap :: The current active charmap for this face. */
  820. /* */
  821. /* <Note> */
  822. /* Fields may be changed after a call to @FT_Attach_File or */
  823. /* @FT_Attach_Stream. */
  824. /* */
  825. typedef struct FT_FaceRec_
  826. {
  827. FT_Long num_faces;
  828. FT_Long face_index;
  829. FT_Long face_flags;
  830. FT_Long style_flags;
  831. FT_Long num_glyphs;
  832. FT_String* family_name;
  833. FT_String* style_name;
  834. FT_Int num_fixed_sizes;
  835. FT_Bitmap_Size* available_sizes;
  836. FT_Int num_charmaps;
  837. FT_CharMap* charmaps;
  838. FT_Generic generic;
  839. /*# The following member variables (down to `underline_thickness') */
  840. /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
  841. /*# for bitmap fonts. */
  842. FT_BBox bbox;
  843. FT_UShort units_per_EM;
  844. FT_Short ascender;
  845. FT_Short descender;
  846. FT_Short height;
  847. FT_Short max_advance_width;
  848. FT_Short max_advance_height;
  849. FT_Short underline_position;
  850. FT_Short underline_thickness;
  851. FT_GlyphSlot glyph;
  852. FT_Size size;
  853. FT_CharMap charmap;
  854. /*@private begin */
  855. FT_Driver driver;
  856. FT_Memory memory;
  857. FT_Stream stream;
  858. FT_ListRec sizes_list;
  859. FT_Generic autohint;
  860. void* extensions;
  861. FT_Face_Internal internal;
  862. /*@private end */
  863. } FT_FaceRec;
  864. /*************************************************************************/
  865. /* */
  866. /* <Enum> */
  867. /* FT_FACE_FLAG_XXX */
  868. /* */
  869. /* <Description> */
  870. /* A list of bit flags used in the `face_flags' field of the */
  871. /* @FT_FaceRec structure. They inform client applications of */
  872. /* properties of the corresponding face. */
  873. /* */
  874. /* <Values> */
  875. /* FT_FACE_FLAG_SCALABLE :: */
  876. /* Indicates that the face contains outline glyphs. This doesn't */
  877. /* prevent bitmap strikes, i.e., a face can have both this and */
  878. /* and @FT_FACE_FLAG_FIXED_SIZES set. */
  879. /* */
  880. /* FT_FACE_FLAG_FIXED_SIZES :: */
  881. /* Indicates that the face contains bitmap strikes. See also the */
  882. /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
  883. /* */
  884. /* FT_FACE_FLAG_FIXED_WIDTH :: */
  885. /* Indicates that the face contains fixed-width characters (like */
  886. /* Courier, Lucido, MonoType, etc.). */
  887. /* */
  888. /* FT_FACE_FLAG_SFNT :: */
  889. /* Indicates that the face uses the `sfnt' storage scheme. For */
  890. /* now, this means TrueType and OpenType. */
  891. /* */
  892. /* FT_FACE_FLAG_HORIZONTAL :: */
  893. /* Indicates that the face contains horizontal glyph metrics. This */
  894. /* should be set for all common formats. */
  895. /* */
  896. /* FT_FACE_FLAG_VERTICAL :: */
  897. /* Indicates that the face contains vertical glyph metrics. This */
  898. /* is only available in some formats, not all of them. */
  899. /* */
  900. /* FT_FACE_FLAG_KERNING :: */
  901. /* Indicates that the face contains kerning information. If set, */
  902. /* the kerning distance can be retrieved through the function */
  903. /* @FT_Get_Kerning. Otherwise the function always return the */
  904. /* vector (0,0). Note that FreeType doesn't handle kerning data */
  905. /* from the `GPOS' table (as present in some OpenType fonts). */
  906. /* */
  907. /* FT_FACE_FLAG_FAST_GLYPHS :: */
  908. /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
  909. /* */
  910. /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
  911. /* Indicates that the font contains multiple masters and is capable */
  912. /* of interpolating between them. See the multiple-masters */
  913. /* specific API for details. */
  914. /* */
  915. /* FT_FACE_FLAG_GLYPH_NAMES :: */
  916. /* Indicates that the font contains glyph names that can be */
  917. /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
  918. /* fonts contain broken glyph name tables. Use the function */
  919. /* @FT_Has_PS_Glyph_Names when needed. */
  920. /* */
  921. /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
  922. /* Used internally by FreeType to indicate that a face's stream was */
  923. /* provided by the client application and should not be destroyed */
  924. /* when @FT_Done_Face is called. Don't read or test this flag. */
  925. /* */
  926. /* FT_FACE_FLAG_HINTER :: */
  927. /* Set if the font driver has a hinting machine of its own. For */
  928. /* example, with TrueType fonts, it makes sense to use data from */
  929. /* the SFNT `gasp' table only if the native TrueType hinting engine */
  930. /* (with the bytecode interpreter) is available and active. */
  931. /* */
  932. #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
  933. #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
  934. #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
  935. #define FT_FACE_FLAG_SFNT ( 1L << 3 )
  936. #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
  937. #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
  938. #define FT_FACE_FLAG_KERNING ( 1L << 6 )
  939. #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
  940. #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
  941. #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
  942. #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
  943. #define FT_FACE_FLAG_HINTER ( 1L << 11 )
  944. /* */
  945. /*************************************************************************
  946. *
  947. * @macro:
  948. * FT_HAS_HORIZONTAL( face )
  949. *
  950. * @description:
  951. * A macro that returns true whenever a face object contains
  952. * horizontal metrics (this is true for all font formats though).
  953. *
  954. * @also:
  955. * @FT_HAS_VERTICAL can be used to check for vertical metrics.
  956. *
  957. */
  958. #define FT_HAS_HORIZONTAL( face ) \
  959. ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
  960. /*************************************************************************
  961. *
  962. * @macro:
  963. * FT_HAS_VERTICAL( face )
  964. *
  965. * @description:
  966. * A macro that returns true whenever a face object contains vertical
  967. * metrics.
  968. *
  969. */
  970. #define FT_HAS_VERTICAL( face ) \
  971. ( face->face_flags & FT_FACE_FLAG_VERTICAL )
  972. /*************************************************************************
  973. *
  974. * @macro:
  975. * FT_HAS_KERNING( face )
  976. *
  977. * @description:
  978. * A macro that returns true whenever a face object contains kerning
  979. * data that can be accessed with @FT_Get_Kerning.
  980. *
  981. */
  982. #define FT_HAS_KERNING( face ) \
  983. ( face->face_flags & FT_FACE_FLAG_KERNING )
  984. /*************************************************************************
  985. *
  986. * @macro:
  987. * FT_IS_SCALABLE( face )
  988. *
  989. * @description:
  990. * A macro that returns true whenever a face object contains a scalable
  991. * font face (true for TrueType, Type 1, Type 42, CID, OpenType/CFF,
  992. * and PFR font formats.
  993. *
  994. */
  995. #define FT_IS_SCALABLE( face ) \
  996. ( face->face_flags & FT_FACE_FLAG_SCALABLE )
  997. /*************************************************************************
  998. *
  999. * @macro:
  1000. * FT_IS_SFNT( face )
  1001. *
  1002. * @description:
  1003. * A macro that returns true whenever a face object contains a font
  1004. * whose format is based on the SFNT storage scheme. This usually
  1005. * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
  1006. * bitmap fonts.
  1007. *
  1008. * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
  1009. * @FT_TRUETYPE_TABLES_H are available.
  1010. *
  1011. */
  1012. #define FT_IS_SFNT( face ) \
  1013. ( face->face_flags & FT_FACE_FLAG_SFNT )
  1014. /*************************************************************************
  1015. *
  1016. * @macro:
  1017. * FT_IS_FIXED_WIDTH( face )
  1018. *
  1019. * @description:
  1020. * A macro that returns true whenever a face object contains a font face
  1021. * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
  1022. * glyphs.
  1023. *
  1024. */
  1025. #define FT_IS_FIXED_WIDTH( face ) \
  1026. ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
  1027. /*************************************************************************
  1028. *
  1029. * @macro:
  1030. * FT_HAS_FIXED_SIZES( face )
  1031. *
  1032. * @description:
  1033. * A macro that returns true whenever a face object contains some
  1034. * embedded bitmaps. See the `available_sizes' field of the
  1035. * @FT_FaceRec structure.
  1036. *
  1037. */
  1038. #define FT_HAS_FIXED_SIZES( face ) \
  1039. ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
  1040. /* */
  1041. /*************************************************************************
  1042. *
  1043. * @macro:
  1044. * FT_HAS_FAST_GLYPHS( face )
  1045. *
  1046. * @description:
  1047. * Deprecated.
  1048. *
  1049. */
  1050. #define FT_HAS_FAST_GLYPHS( face ) 0
  1051. /*************************************************************************
  1052. *
  1053. * @macro:
  1054. * FT_HAS_GLYPH_NAMES( face )
  1055. *
  1056. * @description:
  1057. * A macro that returns true whenever a face object contains some glyph
  1058. * names that can be accessed through @FT_Get_Glyph_Name.
  1059. *
  1060. */
  1061. #define FT_HAS_GLYPH_NAMES( face ) \
  1062. ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
  1063. /*************************************************************************
  1064. *
  1065. * @macro:
  1066. * FT_HAS_MULTIPLE_MASTERS( face )
  1067. *
  1068. * @description:
  1069. * A macro that returns true whenever a face object contains some
  1070. * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
  1071. * are then available to choose the exact design you want.
  1072. *
  1073. */
  1074. #define FT_HAS_MULTIPLE_MASTERS( face ) \
  1075. ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
  1076. /*************************************************************************/
  1077. /* */
  1078. /* <Constant> */
  1079. /* FT_STYLE_FLAG_XXX */
  1080. /* */
  1081. /* <Description> */
  1082. /* A list of bit-flags used to indicate the style of a given face. */
  1083. /* These are used in the `style_flags' field of @FT_FaceRec. */
  1084. /* */
  1085. /* <Values> */
  1086. /* FT_STYLE_FLAG_ITALIC :: */
  1087. /* Indicates that a given face is italicized. */
  1088. /* */
  1089. /* FT_STYLE_FLAG_BOLD :: */
  1090. /* Indicates that a given face is bold. */
  1091. /* */
  1092. #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
  1093. #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
  1094. /*************************************************************************/
  1095. /* */
  1096. /* <Type> */
  1097. /* FT_Size_Internal */
  1098. /* */
  1099. /* <Description> */
  1100. /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
  1101. /* model private data of a given FT_Size object. */
  1102. /* */
  1103. typedef struct FT_Size_InternalRec_* FT_Size_Internal;
  1104. /*************************************************************************/
  1105. /* */
  1106. /* <Struct> */
  1107. /* FT_Size_Metrics */
  1108. /* */
  1109. /* <Description> */
  1110. /* The size metrics structure gives the metrics of a size object. */
  1111. /* */
  1112. /* <Fields> */
  1113. /* x_ppem :: The width of the scaled EM square in pixels, hence */
  1114. /* the term `ppem' (pixels per EM). It is also */
  1115. /* referred to as `nominal width'. */
  1116. /* */
  1117. /* y_ppem :: The height of the scaled EM square in pixels, */
  1118. /* hence the term `ppem' (pixels per EM). It is also */
  1119. /* referred to as `nominal height'. */
  1120. /* */
  1121. /* x_scale :: A 16.16 fractional scaling value used to convert */
  1122. /* horizontal metrics from font units to 26.6 */
  1123. /* fractional pixels. Only relevant for scalable */
  1124. /* font formats. */
  1125. /* */
  1126. /* y_scale :: A 16.16 fractional scaling value used to convert */
  1127. /* vertical metrics from font units to 26.6 */
  1128. /* fractional pixels. Only relevant for scalable */
  1129. /* font formats. */
  1130. /* */
  1131. /* ascender :: The ascender in 26.6 fractional pixels. See */
  1132. /* @FT_FaceRec for the details. */
  1133. /* */
  1134. /* descender :: The descender in 26.6 fractional pixels. See */
  1135. /* @FT_FaceRec for the details. */
  1136. /* */
  1137. /* height :: The height in 26.6 fractional pixels. See */
  1138. /* @FT_FaceRec for the details. */
  1139. /* */
  1140. /* max_advance :: The maximal advance width in 26.6 fractional */
  1141. /* pixels. See @FT_FaceRec for the details. */
  1142. /* */
  1143. /* <Note> */
  1144. /* The scaling values, if relevant, are determined first during a */
  1145. /* size changing operation. The remaining fields are then set by the */
  1146. /* driver. For scalable formats, they are usually set to scaled */
  1147. /* values of the corresponding fields in @FT_FaceRec. */
  1148. /* */
  1149. /* Note that due to glyph hinting, these values might not be exact */
  1150. /* for certain fonts. Thus they must be treated as unreliable */
  1151. /* with an error margin of at least one pixel! */
  1152. /* */
  1153. /* Indeed, the only way to get the exact metrics is to render _all_ */
  1154. /* glyphs. As this would be a definite performance hit, it is up to */
  1155. /* client applications to perform such computations. */
  1156. /* */
  1157. /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
  1158. /* */
  1159. typedef struct FT_Size_Metrics_
  1160. {
  1161. FT_UShort x_ppem; /* horizontal pixels per EM */
  1162. FT_UShort y_ppem; /* vertical pixels per EM */
  1163. FT_Fixed x_scale; /* scaling values used to convert font */
  1164. FT_Fixed y_scale; /* units to 26.6 fractional pixels */
  1165. FT_Pos ascender; /* ascender in 26.6 frac. pixels */
  1166. FT_Pos descender; /* descender in 26.6 frac. pixels */
  1167. FT_Pos height; /* text height in 26.6 frac. pixels */
  1168. FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
  1169. } FT_Size_Metrics;
  1170. /*************************************************************************/
  1171. /* */
  1172. /* <Struct> */
  1173. /* FT_SizeRec */
  1174. /* */
  1175. /* <Description> */
  1176. /* FreeType root size class structure. A size object models a face */
  1177. /* object at a given size. */
  1178. /* */
  1179. /* <Fields> */
  1180. /* face :: Handle to the parent face object. */
  1181. /* */
  1182. /* generic :: A typeless pointer, which is unused by the FreeType */
  1183. /* library or any of its drivers. It can be used by */
  1184. /* client applications to link their own data to each size */
  1185. /* object. */
  1186. /* */
  1187. /* metrics :: Metrics for this size object. This field is read-only. */
  1188. /* */
  1189. typedef struct FT_SizeRec_
  1190. {
  1191. FT_Face face; /* parent face object */
  1192. FT_Generic generic; /* generic pointer for client uses */
  1193. FT_Size_Metrics metrics; /* size metrics */
  1194. FT_Size_Internal internal;
  1195. } FT_SizeRec;
  1196. /*************************************************************************/
  1197. /* */
  1198. /* <Struct> */
  1199. /* FT_SubGlyph */
  1200. /* */
  1201. /* <Description> */
  1202. /* The subglyph structure is an internal object used to describe */
  1203. /* subglyphs (for example, in the case of composites). */
  1204. /* */
  1205. /* <Note> */
  1206. /* The subglyph implementation is not part of the high-level API, */
  1207. /* hence the forward structure declaration. */
  1208. /* */
  1209. /* You can however retrieve subglyph information with */
  1210. /* @FT_Get_SubGlyph_Info. */
  1211. /* */
  1212. typedef struct FT_SubGlyphRec_* FT_SubGlyph;
  1213. /*************************************************************************/
  1214. /* */
  1215. /* <Type> */
  1216. /* FT_Slot_Internal */
  1217. /* */
  1218. /* <Description> */
  1219. /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
  1220. /* model private data of a given FT_GlyphSlot object. */
  1221. /* */
  1222. typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
  1223. /*************************************************************************/
  1224. /* */
  1225. /* <Struct> */
  1226. /* FT_GlyphSlotRec */
  1227. /* */
  1228. /* <Description> */
  1229. /* FreeType root glyph slot class structure. A glyph slot is a */
  1230. /* container where individual glyphs can be loaded, be they in */
  1231. /* outline or bitmap format. */
  1232. /* */
  1233. /* <Fields> */
  1234. /* library :: A handle to the FreeType library instance */
  1235. /* this slot belongs to. */
  1236. /* */
  1237. /* face :: A handle to the parent face object. */
  1238. /* */
  1239. /* next :: In some cases (like some font tools), several */
  1240. /* glyph slots per face object can be a good */
  1241. /* thing. As this is rare, the glyph slots are */
  1242. /* listed through a direct, single-linked list */
  1243. /* using its `next' field. */
  1244. /* */
  1245. /* generic :: A typeless pointer which is unused by the */
  1246. /* FreeType library or any of its drivers. It */
  1247. /* can be used by client applications to link */
  1248. /* their own data to each glyph slot object. */
  1249. /* */
  1250. /* metrics :: The metrics of the last loaded glyph in the */
  1251. /* slot. The returned values depend on the last */
  1252. /* load flags (see the @FT_Load_Glyph API */
  1253. /* function) and can be expressed either in 26.6 */
  1254. /* fractional pixels or font units. */
  1255. /* */
  1256. /* Note that even when the glyph image is */
  1257. /* transformed, the metrics are not. */
  1258. /* */
  1259. /* linearHoriAdvance :: The advance width of the unhinted glyph. */
  1260. /* Its value is expressed in 16.16 fractional */
  1261. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  1262. /* when loading the glyph. This field can be */
  1263. /* important to perform correct WYSIWYG layout. */
  1264. /* Only relevant for outline glyphs. */
  1265. /* */
  1266. /* linearVertAdvance :: The advance height of the unhinted glyph. */
  1267. /* Its value is expressed in 16.16 fractional */
  1268. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  1269. /* when loading the glyph. This field can be */
  1270. /* important to perform correct WYSIWYG layout. */
  1271. /* Only relevant for outline glyphs. */
  1272. /* */
  1273. /* advance :: This is the transformed advance width for the */
  1274. /* glyph. */
  1275. /* */
  1276. /* format :: This field indicates the format of the image */
  1277. /* contained in the glyph slot. Typically */
  1278. /* @FT_GLYPH_FORMAT_BITMAP, */
  1279. /* @FT_GLYPH_FORMAT_OUTLINE, or */
  1280. /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
  1281. /* possible. */
  1282. /* */
  1283. /* bitmap :: This field is used as a bitmap descriptor */
  1284. /* when the slot format is */
  1285. /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
  1286. /* address and content of the bitmap buffer can */
  1287. /* change between calls of @FT_Load_Glyph and a */
  1288. /* few other functions. */
  1289. /* */
  1290. /* bitmap_left :: This is the bitmap's left bearing expressed */
  1291. /* in integer pixels. Of course, this is only */
  1292. /* valid if the format is */
  1293. /* @FT_GLYPH_FORMAT_BITMAP. */
  1294. /* */
  1295. /* bitmap_top :: This is the bitmap's top bearing expressed in */
  1296. /* integer pixels. Remember that this is the */
  1297. /* distance from the baseline to the top-most */
  1298. /* glyph scanline, upwards y-coordinates being */
  1299. /* *positive*. */
  1300. /* */
  1301. /* outline :: The outline descriptor for the current glyph */
  1302. /* image if its format is */
  1303. /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
  1304. /* loaded, `outline' can be transformed, */
  1305. /* distorted, embolded, etc. However, it must */
  1306. /* not be freed. */
  1307. /* */
  1308. /* num_subglyphs :: The number of subglyphs in a composite glyph. */
  1309. /* This field is only valid for the composite */
  1310. /* glyph format that should normally only be */
  1311. /* loaded with the @FT_LOAD_NO_RECURSE flag. */
  1312. /* For now this is internal to FreeType. */
  1313. /* */
  1314. /* subglyphs :: An array of subglyph descriptors for */
  1315. /* composite glyphs. There are `num_subglyphs' */
  1316. /* elements in there. Currently internal to */
  1317. /* FreeType. */
  1318. /* */
  1319. /* control_data :: Certain font drivers can also return the */
  1320. /* control data for a given glyph image (e.g. */
  1321. /* TrueType bytecode, Type 1 charstrings, etc.). */
  1322. /* This field is a pointer to such data. */
  1323. /* */
  1324. /* control_len :: This is the length in bytes of the control */
  1325. /* data. */
  1326. /* */
  1327. /* other :: Really wicked formats can use this pointer to */
  1328. /* present their own glyph image to client */
  1329. /* applications. Note that the application */
  1330. /* needs to know about the image format. */
  1331. /* */
  1332. /* lsb_delta :: The difference between hinted and unhinted */
  1333. /* left side bearing while autohinting is */
  1334. /* active. Zero otherwise. */
  1335. /* */
  1336. /* rsb_delta :: The difference between hinted and unhinted */
  1337. /* right side bearing while autohinting is */
  1338. /* active. Zero otherwise. */
  1339. /* */
  1340. /* <Note> */
  1341. /* If @FT_Load_Glyph is called with default flags (see */
  1342. /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
  1343. /* its native format (e.g., an outline glyph for TrueType and Type 1 */
  1344. /* formats). */
  1345. /* */
  1346. /* This image can later be converted into a bitmap by calling */
  1347. /* @FT_Render_Glyph. This function finds the current renderer for */
  1348. /* the native image's format then invokes it. */
  1349. /* */
  1350. /* The renderer is in charge of transforming the native image through */
  1351. /* the slot's face transformation fields, then convert it into a */
  1352. /* bitmap that is returned in `slot->bitmap'. */
  1353. /* */
  1354. /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
  1355. /* to specify the position of the bitmap relative to the current pen */
  1356. /* position (e.g., coordinates (0,0) on the baseline). Of course, */
  1357. /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
  1358. /* */
  1359. /* <Note> */
  1360. /* Here a small pseudo code fragment which shows how to use */
  1361. /* `lsb_delta' and `rsb_delta': */
  1362. /* */
  1363. /* { */
  1364. /* FT_Pos origin_x = 0; */
  1365. /* FT_Pos prev_rsb_delta = 0; */
  1366. /* */
  1367. /* */
  1368. /* for all glyphs do */
  1369. /* <compute kern between current and previous glyph and add it to */
  1370. /* `origin_x'> */
  1371. /* */
  1372. /* <load glyph with `FT_Load_Glyph'> */
  1373. /* */
  1374. /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
  1375. /* origin_x -= 64; */
  1376. /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
  1377. /* origin_x += 64; */
  1378. /* */
  1379. /* prev_rsb_delta = face->glyph->rsb_delta; */
  1380. /* */
  1381. /* <save glyph image, or render glyph, or ...> */
  1382. /* */
  1383. /* origin_x += face->glyph->advance.x; */
  1384. /* endfor */
  1385. /* } */
  1386. /* */
  1387. typedef struct FT_GlyphSlotRec_
  1388. {
  1389. FT_Library library;
  1390. FT_Face face;
  1391. FT_GlyphSlot next;
  1392. FT_UInt reserved; /* retained for binary compatibility */
  1393. FT_Generic generic;
  1394. FT_Glyph_Metrics metrics;
  1395. FT_Fixed linearHoriAdvance;
  1396. FT_Fixed linearVertAdvance;
  1397. FT_Vector advance;
  1398. FT_Glyph_Format format;
  1399. FT_Bitmap bitmap;
  1400. FT_Int bitmap_left;
  1401. FT_Int bitmap_top;
  1402. FT_Outline outline;
  1403. FT_UInt num_subglyphs;
  1404. FT_SubGlyph subglyphs;
  1405. void* control_data;
  1406. long control_len;
  1407. FT_Pos lsb_delta;
  1408. FT_Pos rsb_delta;
  1409. void* other;
  1410. FT_Slot_Internal internal;
  1411. } FT_GlyphSlotRec;
  1412. /*************************************************************************/
  1413. /*************************************************************************/
  1414. /* */
  1415. /* F U N C T I O N S */
  1416. /* */
  1417. /*************************************************************************/
  1418. /*************************************************************************/
  1419. /*************************************************************************/
  1420. /* */
  1421. /* <Function> */
  1422. /* FT_Init_FreeType */
  1423. /* */
  1424. /* <Description> */
  1425. /* Initialize a new FreeType library object. The set of modules */
  1426. /* that are registered by this function is determined at build time. */
  1427. /* */
  1428. /* <Output> */
  1429. /* alibrary :: A handle to a new library object. */
  1430. /* */
  1431. /* <Return> */
  1432. /* FreeType error code. 0 means success. */
  1433. /* */
  1434. FT_EXPORT( FT_Error )
  1435. FT_Init_FreeType( FT_Library *alibrary );
  1436. /*************************************************************************/
  1437. /* */
  1438. /* <Function> */
  1439. /* FT_Done_FreeType */
  1440. /* */
  1441. /* <Description> */
  1442. /* Destroy a given FreeType library object and all of its children, */
  1443. /* including resources, drivers, faces, sizes, etc. */
  1444. /* */
  1445. /* <Input> */
  1446. /* library :: A handle to the target library object. */
  1447. /* */
  1448. /* <Return> */
  1449. /* FreeType error code. 0 means success. */
  1450. /* */
  1451. FT_EXPORT( FT_Error )
  1452. FT_Done_FreeType( FT_Library library );
  1453. /*************************************************************************/
  1454. /* */
  1455. /* <Enum> */
  1456. /* FT_OPEN_XXX */
  1457. /* */
  1458. /* <Description> */
  1459. /* A list of bit-field constants used within the `flags' field of the */
  1460. /* @FT_Open_Args structure. */
  1461. /* */
  1462. /* <Values> */
  1463. /* FT_OPEN_MEMORY :: This is a memory-based stream. */
  1464. /* */
  1465. /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
  1466. /* */
  1467. /* FT_OPEN_PATHNAME :: Create a new input stream from a C */
  1468. /* path name. */
  1469. /* */
  1470. /* FT_OPEN_DRIVER :: Use the `driver' field. */
  1471. /* */
  1472. /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
  1473. /* */
  1474. /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
  1475. /* */
  1476. /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
  1477. /* */
  1478. /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
  1479. /* */
  1480. /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
  1481. /* */
  1482. /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
  1483. /* */
  1484. /* <Note> */
  1485. /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
  1486. /* flags are mutually exclusive. */
  1487. /* */
  1488. #define FT_OPEN_MEMORY 0x1
  1489. #define FT_OPEN_STREAM 0x2
  1490. #define FT_OPEN_PATHNAME 0x4
  1491. #define FT_OPEN_DRIVER 0x8
  1492. #define FT_OPEN_PARAMS 0x10
  1493. #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
  1494. #define ft_open_stream FT_OPEN_STREAM /* deprecated */
  1495. #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
  1496. #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
  1497. #define ft_open_params FT_OPEN_PARAMS /* deprecated */
  1498. /*************************************************************************/
  1499. /* */
  1500. /* <Struct> */
  1501. /* FT_Parameter */
  1502. /* */
  1503. /* <Description> */
  1504. /* A simple structure used to pass more or less generic parameters */
  1505. /* to @FT_Open_Face. */
  1506. /* */
  1507. /* <Fields> */
  1508. /* tag :: A four-byte identification tag. */
  1509. /* */
  1510. /* data :: A pointer to the parameter data. */
  1511. /* */
  1512. /* <Note> */
  1513. /* The ID and function of parameters are driver-specific. */
  1514. /* */
  1515. typedef struct FT_Parameter_
  1516. {
  1517. FT_ULong tag;
  1518. FT_Pointer data;
  1519. } FT_Parameter;
  1520. /*************************************************************************/
  1521. /* */
  1522. /* <Struct> */
  1523. /* FT_Open_Args */
  1524. /* */
  1525. /* <Description> */
  1526. /* A structure used to indicate how to open a new font file or */
  1527. /* stream. A pointer to such a structure can be used as a parameter */
  1528. /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
  1529. /* */
  1530. /* <Fields> */
  1531. /* flags :: A set of bit flags indicating how to use the */
  1532. /* structure. */
  1533. /* */
  1534. /* memory_base :: The first byte of the file in memory. */
  1535. /* */
  1536. /* memory_size :: The size in bytes of the file in memory. */
  1537. /* */
  1538. /* pathname :: A pointer to an 8-bit file pathname. */
  1539. /* */
  1540. /* stream :: A handle to a source stream object. */
  1541. /* */
  1542. /* driver :: This field is exclusively used by @FT_Open_Face; */
  1543. /* it simply specifies the font driver to use to open */
  1544. /* the face. If set to 0, FreeType tries to load the */
  1545. /* face with each one of the drivers in its list. */
  1546. /* */
  1547. /* num_params :: The number of extra parameters. */
  1548. /* */
  1549. /* params :: Extra parameters passed to the font driver when */
  1550. /* opening a new face. */
  1551. /* */
  1552. /* <Note> */
  1553. /* The stream type is determined by the contents of `flags' which */
  1554. /* are tested in the following order by @FT_Open_Face: */
  1555. /* */
  1556. /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
  1557. /* memory file of `memory_size' bytes, located at `memory_address'. */
  1558. /* The data are are not copied, and the client is responsible for */
  1559. /* releasing and destroying them _after_ the corresponding call to */
  1560. /* @FT_Done_Face. */
  1561. /* */
  1562. /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
  1563. /* custom input stream `stream' is used. */
  1564. /* */
  1565. /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
  1566. /* is a normal file and use `pathname' to open it. */
  1567. /* */
  1568. /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
  1569. /* open the file with the driver whose handler is in `driver'. */
  1570. /* */
  1571. /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
  1572. /* `num_params' and `params' is used. They are ignored otherwise. */
  1573. /* */
  1574. /* Ideally, both the `pathname' and `params' fields should be tagged */
  1575. /* as `const'; this is missing for API backwards compatibility. With */
  1576. /* other words, applications should treat them as read-only. */
  1577. /* */
  1578. typedef struct FT_Open_Args_
  1579. {
  1580. FT_UInt flags;
  1581. const FT_Byte* memory_base;
  1582. FT_Long memory_size;
  1583. FT_String* pathname;
  1584. FT_Stream stream;
  1585. FT_Module driver;
  1586. FT_Int num_params;
  1587. FT_Parameter* params;
  1588. } FT_Open_Args;
  1589. /*************************************************************************/
  1590. /* */
  1591. /* <Function> */
  1592. /* FT_New_Face */
  1593. /* */
  1594. /* <Description> */
  1595. /* This function calls @FT_Open_Face to open a font by its pathname. */
  1596. /* */
  1597. /* <InOut> */
  1598. /* library :: A handle to the library resource. */
  1599. /* */
  1600. /* <Input> */
  1601. /* pathname :: A path to the font file. */
  1602. /* */
  1603. /* face_index :: The index of the face within the font. The first */
  1604. /* face has index 0. */
  1605. /* */
  1606. /* <Output> */
  1607. /* aface :: A handle to a new face object. If `face_index' is */
  1608. /* greater than or equal to zero, it must be non-NULL. */
  1609. /* See @FT_Open_Face for more details. */
  1610. /* */
  1611. /* <Return> */
  1612. /* FreeType error code. 0 means success. */
  1613. /* */
  1614. FT_EXPORT( FT_Error )
  1615. FT_New_Face( FT_Library library,
  1616. const char* filepathname,
  1617. FT_Long face_index,
  1618. FT_Face *aface );
  1619. /*************************************************************************/
  1620. /* */
  1621. /* <Function> */
  1622. /* FT_New_Memory_Face */
  1623. /* */
  1624. /* <Description> */
  1625. /* This function calls @FT_Open_Face to open a font which has been */
  1626. /* loaded into memory. */
  1627. /* */
  1628. /* <InOut> */
  1629. /* library :: A handle to the library resource. */
  1630. /* */
  1631. /* <Input> */
  1632. /* file_base :: A pointer to the beginning of the font data. */
  1633. /* */
  1634. /* file_size :: The size of the memory chunk used by the font data. */
  1635. /* */
  1636. /* face_index :: The index of the face within the font. The first */
  1637. /* face has index 0. */
  1638. /* */
  1639. /* <Output> */
  1640. /* aface :: A handle to a new face object. If `face_index' is */
  1641. /* greater than or equal to zero, it must be non-NULL. */
  1642. /* See @FT_Open_Face for more details. */
  1643. /* */
  1644. /* <Return> */
  1645. /* FreeType error code. 0 means success. */
  1646. /* */
  1647. /* <Note> */
  1648. /* You must not deallocate the memory before calling @FT_Done_Face. */
  1649. /* */
  1650. FT_EXPORT( FT_Error )
  1651. FT_New_Memory_Face( FT_Library library,
  1652. const FT_Byte* file_base,
  1653. FT_Long file_size,
  1654. FT_Long face_index,
  1655. FT_Face *aface );
  1656. /*************************************************************************/
  1657. /* */
  1658. /* <Function> */
  1659. /* FT_Open_Face */
  1660. /* */
  1661. /* <Description> */
  1662. /* Create a face object from a given resource described by */
  1663. /* @FT_Open_Args. */
  1664. /* */
  1665. /* <InOut> */
  1666. /* library :: A handle to the library resource. */
  1667. /* */
  1668. /* <Input> */
  1669. /* args :: A pointer to an `FT_Open_Args' structure which must */
  1670. /* be filled by the caller. */
  1671. /* */
  1672. /* face_index :: The index of the face within the font. The first */
  1673. /* face has index 0. */
  1674. /* */
  1675. /* <Output> */
  1676. /* aface :: A handle to a new face object. If `face_index' is */
  1677. /* greater than or equal to zero, it must be non-NULL. */
  1678. /* See note below. */
  1679. /* */
  1680. /* <Return> */
  1681. /* FreeType error code. 0 means success. */
  1682. /* */
  1683. /* <Note> */
  1684. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  1685. /* slot for the face object which can be accessed directly through */
  1686. /* `face->glyph'. */
  1687. /* */
  1688. /* FT_Open_Face can be used to quickly check whether the font */
  1689. /* format of a given font resource is supported by FreeType. If the */
  1690. /* `face_index' field is negative, the function's return value is 0 */
  1691. /* if the font format is recognized, or non-zero otherwise; */
  1692. /* the function returns a more or less empty face handle in `*aface' */
  1693. /* (if `aface' isn't NULL). The only useful field in this special */
  1694. /* case is `face->num_faces' which gives the number of faces within */
  1695. /* the font file. After examination, the returned @FT_Face structure */
  1696. /* should be deallocated with a call to @FT_Done_Face. */
  1697. /* */
  1698. /* Each new face object created with this function also owns a */
  1699. /* default @FT_Size object, accessible as `face->size'. */
  1700. /* */
  1701. FT_EXPORT( FT_Error )
  1702. FT_Open_Face( FT_Library library,
  1703. const FT_Open_Args* args,
  1704. FT_Long face_index,
  1705. FT_Face *aface );
  1706. /*************************************************************************/
  1707. /* */
  1708. /* <Function> */
  1709. /* FT_Attach_File */
  1710. /* */
  1711. /* <Description> */
  1712. /* This function calls @FT_Attach_Stream to attach a file. */
  1713. /* */
  1714. /* <InOut> */
  1715. /* face :: The target face object. */
  1716. /* */
  1717. /* <Input> */
  1718. /* filepathname :: The pathname. */
  1719. /* */
  1720. /* <Return> */
  1721. /* FreeType error code. 0 means success. */
  1722. /* */
  1723. FT_EXPORT( FT_Error )
  1724. FT_Attach_File( FT_Face face,
  1725. const char* filepathname );
  1726. /*************************************************************************/
  1727. /* */
  1728. /* <Function> */
  1729. /* FT_Attach_Stream */
  1730. /* */
  1731. /* <Description> */
  1732. /* `Attach' data to a face object. Normally, this is used to read */
  1733. /* additional information for the face object. For example, you can */
  1734. /* attach an AFM file that comes with a Type 1 font to get the */
  1735. /* kerning values and other metrics. */
  1736. /* */
  1737. /* <InOut> */
  1738. /* face :: The target face object. */
  1739. /* */
  1740. /* <Input> */
  1741. /* parameters :: A pointer to @FT_Open_Args which must be filled by */
  1742. /* the caller. */
  1743. /* */
  1744. /* <Return> */
  1745. /* FreeType error code. 0 means success. */
  1746. /* */
  1747. /* <Note> */
  1748. /* The meaning of the `attach' (i.e., what really happens when the */
  1749. /* new file is read) is not fixed by FreeType itself. It really */
  1750. /* depends on the font format (and thus the font driver). */
  1751. /* */
  1752. /* Client applications are expected to know what they are doing */
  1753. /* when invoking this function. Most drivers simply do not implement */
  1754. /* file attachments. */
  1755. /* */
  1756. FT_EXPORT( FT_Error )
  1757. FT_Attach_Stream( FT_Face face,
  1758. FT_Open_Args* parameters );
  1759. /*************************************************************************/
  1760. /* */
  1761. /* <Function> */
  1762. /* FT_Done_Face */
  1763. /* */
  1764. /* <Description> */
  1765. /* Discard a given face object, as well as all of its child slots and */
  1766. /* sizes. */
  1767. /* */
  1768. /* <Input> */
  1769. /* face :: A handle to a target face object. */
  1770. /* */
  1771. /* <Return> */
  1772. /* FreeType error code. 0 means success. */
  1773. /* */
  1774. FT_EXPORT( FT_Error )
  1775. FT_Done_Face( FT_Face face );
  1776. /*************************************************************************/
  1777. /* */
  1778. /* <Function> */
  1779. /* FT_Select_Size */
  1780. /* */
  1781. /* <Description> */
  1782. /* Select a bitmap strike. */
  1783. /* */
  1784. /* <InOut> */
  1785. /* face :: A handle to a target face object. */
  1786. /* */
  1787. /* <Input> */
  1788. /* strike_index :: The index of the bitmap strike in the */
  1789. /* `available_sizes' field of @FT_FaceRec structure. */
  1790. /* */
  1791. /* <Return> */
  1792. /* FreeType error code. 0 means success. */
  1793. /* */
  1794. FT_EXPORT( FT_Error )
  1795. FT_Select_Size( FT_Face face,
  1796. FT_Int strike_index );
  1797. /*************************************************************************/
  1798. /* */
  1799. /* <Enum> */
  1800. /* FT_Size_Request_Type */
  1801. /* */
  1802. /* <Description> */
  1803. /* An enumeration type that lists the supported size request types. */
  1804. /* */
  1805. /* <Values> */
  1806. /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
  1807. /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
  1808. /* used to determine both scaling values. */
  1809. /* */
  1810. /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
  1811. /* The real dimension. The sum of the the `Ascender' and (minus */
  1812. /* of) the `Descender' fields of @FT_FaceRec are used to determine */
  1813. /* both scaling values. */
  1814. /* */
  1815. /* FT_SIZE_REQUEST_TYPE_BBOX :: */
  1816. /* The font bounding box. The width and height of the `bbox' field */
  1817. /* of @FT_FaceRec are used to determine the horizontal and vertical */
  1818. /* scaling value, respectively. */
  1819. /* */
  1820. /* FT_SIZE_REQUEST_TYPE_CELL :: */
  1821. /* The `max_advance_width' field of @FT_FaceRec is used to */
  1822. /* determine the horizontal scaling value; the vertical scaling */
  1823. /* value is determined the same way as */
  1824. /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
  1825. /* values are set to the smaller one. This type is useful if you */
  1826. /* want to specify the font size for, say, a window of a given */
  1827. /* dimension and 80x24 cells. */
  1828. /* */
  1829. /* FT_SIZE_REQUEST_TYPE_SCALES :: */
  1830. /* Specify the scaling values directly. */
  1831. /* */
  1832. /* <Note> */
  1833. /* The above descriptions only apply to scalable formats. For bitmap */
  1834. /* formats, the behaviour is up to the driver. */
  1835. /* */
  1836. /* See the note section of @FT_Size_Metrics if you wonder how size */
  1837. /* requesting relates to scaling values. */
  1838. /* */
  1839. typedef enum FT_Size_Request_Type_
  1840. {
  1841. FT_SIZE_REQUEST_TYPE_NOMINAL,
  1842. FT_SIZE_REQUEST_TYPE_REAL_DIM,
  1843. FT_SIZE_REQUEST_TYPE_BBOX,
  1844. FT_SIZE_REQUEST_TYPE_CELL,
  1845. FT_SIZE_REQUEST_TYPE_SCALES,
  1846. FT_SIZE_REQUEST_TYPE_MAX
  1847. } FT_Size_Request_Type;
  1848. /*************************************************************************/
  1849. /* */
  1850. /* <Struct> */
  1851. /* FT_Size_RequestRec */
  1852. /* */
  1853. /* <Description> */
  1854. /* A structure used to model a size request. */
  1855. /* */
  1856. /* <Fields> */
  1857. /* type :: See @FT_Size_Request_Type. */
  1858. /* */
  1859. /* width :: The desired width. */
  1860. /* */
  1861. /* height :: The desired height. */
  1862. /* */
  1863. /* horiResolution :: The horizontal resolution. If set to zero, */
  1864. /* `width' is treated as a 26.6 fractional pixel */
  1865. /* value. */
  1866. /* */
  1867. /* vertResolution :: The vertical resolution. If set to zero, */
  1868. /* `height' is treated as a 26.6 fractional pixel */
  1869. /* value. */
  1870. /* */
  1871. /* <Note> */
  1872. /* If `width' is zero, then the horizontal scaling value is set */
  1873. /* equal to the vertical scaling value, and vice versa. */
  1874. /* */
  1875. typedef struct FT_Size_RequestRec_
  1876. {
  1877. FT_Size_Request_Type type;
  1878. FT_Long width;
  1879. FT_Long height;
  1880. FT_UInt horiResolution;
  1881. FT_UInt vertResolution;
  1882. } FT_Size_RequestRec, *FT_Size_Request;
  1883. /*************************************************************************/
  1884. /* */
  1885. /* <Function> */
  1886. /* FT_Request_Size */
  1887. /* */
  1888. /* <Description> */
  1889. /* Resize the scale of the active @FT_Size object in a face. */
  1890. /* */
  1891. /* <InOut> */
  1892. /* face :: A handle to a target face object. */
  1893. /* */
  1894. /* <Input> */
  1895. /* req :: A pointer to a @FT_Size_RequestRec. */
  1896. /* */
  1897. /* <Return> */
  1898. /* FreeType error code. 0 means success. */
  1899. /* */
  1900. /* <Note> */
  1901. /* Although drivers may select the bitmap strike matching the */
  1902. /* request, you should not rely on this if you intend to select a */
  1903. /* particular bitmap strike. Use @FT_Select_Size instead in that */
  1904. /* case. */
  1905. /* */
  1906. FT_EXPORT( FT_Error )
  1907. FT_Request_Size( FT_Face face,
  1908. FT_Size_Request req );
  1909. /*************************************************************************/
  1910. /* */
  1911. /* <Function> */
  1912. /* FT_Set_Char_Size */
  1913. /* */
  1914. /* <Description> */
  1915. /* This function calls @FT_Request_Size to request the nominal size */
  1916. /* (in points). */
  1917. /* */
  1918. /* <InOut> */
  1919. /* face :: A handle to a target face object. */
  1920. /* */
  1921. /* <Input> */
  1922. /* char_width :: The nominal width, in 26.6 fractional points. */
  1923. /* */
  1924. /* char_height :: The nominal height, in 26.6 fractional points. */
  1925. /* */
  1926. /* horz_resolution :: The horizontal resolution in dpi. */
  1927. /* */
  1928. /* vert_resolution :: The vertical resolution in dpi. */
  1929. /* */
  1930. /* <Return> */
  1931. /* FreeType error code. 0 means success. */
  1932. /* */
  1933. /* <Note> */
  1934. /* If either the character width or height is zero, it is set equal */
  1935. /* to the other value. */
  1936. /* */
  1937. /* If either the horizontal or vertical resolution is zero, it is set */
  1938. /* equal to the other value. */
  1939. /* */
  1940. /* A character width or height smaller than 1pt is set to 1pt; if */
  1941. /* both resolution values are zero, they are set to 72dpi. */
  1942. /* */
  1943. FT_EXPORT( FT_Error )
  1944. FT_Set_Char_Size( FT_Face face,
  1945. FT_F26Dot6 char_width,
  1946. FT_F26Dot6 char_height,
  1947. FT_UInt horz_resolution,
  1948. FT_UInt vert_resolution );
  1949. /*************************************************************************/
  1950. /* */
  1951. /* <Function> */
  1952. /* FT_Set_Pixel_Sizes */
  1953. /* */
  1954. /* <Description> */
  1955. /* This function calls @FT_Request_Size to request the nominal size */
  1956. /* (in pixels). */
  1957. /* */
  1958. /* <InOut> */
  1959. /* face :: A handle to the target face object. */
  1960. /* */
  1961. /* <Input> */
  1962. /* pixel_width :: The nominal width, in pixels. */
  1963. /* */
  1964. /* pixel_height :: The nominal height, in pixels. */
  1965. /* */
  1966. /* <Return> */
  1967. /* FreeType error code. 0 means success. */
  1968. /* */
  1969. FT_EXPORT( FT_Error )
  1970. FT_Set_Pixel_Sizes( FT_Face face,
  1971. FT_UInt pixel_width,
  1972. FT_UInt pixel_height );
  1973. /*************************************************************************/
  1974. /* */
  1975. /* <Function> */
  1976. /* FT_Load_Glyph */
  1977. /* */
  1978. /* <Description> */
  1979. /* A function used to load a single glyph into the glyph slot of a */
  1980. /* face object. */
  1981. /* */
  1982. /* <InOut> */
  1983. /* face :: A handle to the target face object where the glyph */
  1984. /* is loaded. */
  1985. /* */
  1986. /* <Input> */
  1987. /* glyph_index :: The index of the glyph in the font file. For */
  1988. /* CID-keyed fonts (either in PS or in CFF format) */
  1989. /* this argument specifies the CID value. */
  1990. /* */
  1991. /* load_flags :: A flag indicating what to load for this glyph. The */
  1992. /* @FT_LOAD_XXX constants can be used to control the */
  1993. /* glyph loading process (e.g., whether the outline */
  1994. /* should be scaled, whether to load bitmaps or not, */
  1995. /* whether to hint the outline, etc). */
  1996. /* */
  1997. /* <Return> */
  1998. /* FreeType error code. 0 means success. */
  1999. /* */
  2000. /* <Note> */
  2001. /* The loaded glyph may be transformed. See @FT_Set_Transform for */
  2002. /* the details. */
  2003. /* */
  2004. FT_EXPORT( FT_Error )
  2005. FT_Load_Glyph( FT_Face face,
  2006. FT_UInt glyph_index,
  2007. FT_Int32 load_flags );
  2008. /*************************************************************************/
  2009. /* */
  2010. /* <Function> */
  2011. /* FT_Load_Char */
  2012. /* */
  2013. /* <Description> */
  2014. /* A function used to load a single glyph into the glyph slot of a */
  2015. /* face object, according to its character code. */
  2016. /* */
  2017. /* <InOut> */
  2018. /* face :: A handle to a target face object where the glyph */
  2019. /* is loaded. */
  2020. /* */
  2021. /* <Input> */
  2022. /* char_code :: The glyph's character code, according to the */
  2023. /* current charmap used in the face. */
  2024. /* */
  2025. /* load_flags :: A flag indicating what to load for this glyph. The */
  2026. /* @FT_LOAD_XXX constants can be used to control the */
  2027. /* glyph loading process (e.g., whether the outline */
  2028. /* should be scaled, whether to load bitmaps or not, */
  2029. /* whether to hint the outline, etc). */
  2030. /* */
  2031. /* <Return> */
  2032. /* FreeType error code. 0 means success. */
  2033. /* */
  2034. /* <Note> */
  2035. /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
  2036. /* */
  2037. FT_EXPORT( FT_Error )
  2038. FT_Load_Char( FT_Face face,
  2039. FT_ULong char_code,
  2040. FT_Int32 load_flags );
  2041. /*************************************************************************
  2042. *
  2043. * @enum:
  2044. * FT_LOAD_XXX
  2045. *
  2046. * @description:
  2047. * A list of bit-field constants used with @FT_Load_Glyph to indicate
  2048. * what kind of operations to perform during glyph loading.
  2049. *
  2050. * @values:
  2051. * FT_LOAD_DEFAULT ::
  2052. * Corresponding to 0, this value is used as the default glyph load
  2053. * operation. In this case, the following happens:
  2054. *
  2055. * 1. FreeType looks for a bitmap for the glyph corresponding to the
  2056. * face's current size. If one is found, the function returns.
  2057. * The bitmap data can be accessed from the glyph slot (see note
  2058. * below).
  2059. *
  2060. * 2. If no embedded bitmap is searched or found, FreeType looks for a
  2061. * scalable outline. If one is found, it is loaded from the font
  2062. * file, scaled to device pixels, then `hinted' to the pixel grid
  2063. * in order to optimize it. The outline data can be accessed from
  2064. * the glyph slot (see note below).
  2065. *
  2066. * Note that by default, the glyph loader doesn't render outlines into
  2067. * bitmaps. The following flags are used to modify this default
  2068. * behaviour to more specific and useful cases.
  2069. *
  2070. * FT_LOAD_NO_SCALE ::
  2071. * Don't scale the outline glyph loaded, but keep it in font units.
  2072. *
  2073. * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
  2074. * unsets @FT_LOAD_RENDER.
  2075. *
  2076. * FT_LOAD_NO_HINTING ::
  2077. * Disable hinting. This generally generates `blurrier' bitmap glyph
  2078. * when the glyph is rendered in any of the anti-aliased modes. See
  2079. * also the note below.
  2080. *
  2081. * This flag is implied by @FT_LOAD_NO_SCALE.
  2082. *
  2083. * FT_LOAD_RENDER ::
  2084. * Call @FT_Render_Glyph after the glyph is loaded. By default, the
  2085. * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
  2086. * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
  2087. *
  2088. * This flag is unset by @FT_LOAD_NO_SCALE.
  2089. *
  2090. * FT_LOAD_NO_BITMAP ::
  2091. * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
  2092. * flag.
  2093. *
  2094. * @FT_LOAD_NO_SCALE always sets this flag.
  2095. *
  2096. * FT_LOAD_VERTICAL_LAYOUT ::
  2097. * Load the glyph for vertical text layout. _Don't_ use it as it is
  2098. * problematic currently.
  2099. *
  2100. * FT_LOAD_FORCE_AUTOHINT ::
  2101. * Indicates that the auto-hinter is preferred over the font's native
  2102. * hinter. See also the note below.
  2103. *
  2104. * FT_LOAD_CROP_BITMAP ::
  2105. * Indicates that the font driver should crop the loaded bitmap glyph
  2106. * (i.e., remove all space around its black bits). Not all drivers
  2107. * implement this.
  2108. *
  2109. * FT_LOAD_PEDANTIC ::
  2110. * Indicates that the font driver should perform pedantic verifications
  2111. * during glyph loading. This is mostly used to detect broken glyphs
  2112. * in fonts. By default, FreeType tries to handle broken fonts also.
  2113. *
  2114. * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
  2115. * Indicates that the font driver should ignore the global advance
  2116. * width defined in the font. By default, that value is used as the
  2117. * advance width for all glyphs when the face has
  2118. * @FT_FACE_FLAG_FIXED_WIDTH set.
  2119. *
  2120. * This flag exists for historical reasons (to support buggy CJK
  2121. * fonts).
  2122. *
  2123. * FT_LOAD_NO_RECURSE ::
  2124. * This flag is only used internally. It merely indicates that the
  2125. * font driver should not load composite glyphs recursively. Instead,
  2126. * it should set the `num_subglyph' and `subglyphs' values of the
  2127. * glyph slot accordingly, and set `glyph->format' to
  2128. * @FT_GLYPH_FORMAT_COMPOSITE.
  2129. *
  2130. * The description of sub-glyphs is not available to client
  2131. * applications for now.
  2132. *
  2133. * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
  2134. *
  2135. * FT_LOAD_IGNORE_TRANSFORM ::
  2136. * Indicates that the transform matrix set by @FT_Set_Transform should
  2137. * be ignored.
  2138. *
  2139. * FT_LOAD_MONOCHROME ::
  2140. * This flag is used with @FT_LOAD_RENDER to indicate that you want to
  2141. * render an outline glyph to a 1-bit monochrome bitmap glyph, with
  2142. * 8 pixels packed into each byte of the bitmap data.
  2143. *
  2144. * Note that this has no effect on the hinting algorithm used. You
  2145. * should use @FT_LOAD_TARGET_MONO instead so that the
  2146. * monochrome-optimized hinting algorithm is used.
  2147. *
  2148. * FT_LOAD_LINEAR_DESIGN ::
  2149. * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
  2150. * fields of @FT_GlyphSlotRec should be kept in font units. See
  2151. * @FT_GlyphSlotRec for details.
  2152. *
  2153. * FT_LOAD_NO_AUTOHINT ::
  2154. * Disable auto-hinter. See also the note below.
  2155. *
  2156. * @note:
  2157. * By default, hinting is enabled and the font's native hinter (see
  2158. * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
  2159. * disable hinting by setting @FT_LOAD_NO_HINTING or change the
  2160. * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
  2161. * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
  2162. * used at all.
  2163. *
  2164. * Besides deciding which hinter to use, you can also decide which
  2165. * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
  2166. */
  2167. #define FT_LOAD_DEFAULT 0x0
  2168. #define FT_LOAD_NO_SCALE 0x1
  2169. #define FT_LOAD_NO_HINTING 0x2
  2170. #define FT_LOAD_RENDER 0x4
  2171. #define FT_LOAD_NO_BITMAP 0x8
  2172. #define FT_LOAD_VERTICAL_LAYOUT 0x10
  2173. #define FT_LOAD_FORCE_AUTOHINT 0x20
  2174. #define FT_LOAD_CROP_BITMAP 0x40
  2175. #define FT_LOAD_PEDANTIC 0x80
  2176. #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
  2177. #define FT_LOAD_NO_RECURSE 0x400
  2178. #define FT_LOAD_IGNORE_TRANSFORM 0x800
  2179. #define FT_LOAD_MONOCHROME 0x1000
  2180. #define FT_LOAD_LINEAR_DESIGN 0x2000
  2181. /* temporary hack! */
  2182. #define FT_LOAD_SBITS_ONLY 0x4000
  2183. #define FT_LOAD_NO_AUTOHINT 0x8000U
  2184. /* */
  2185. /**************************************************************************
  2186. *
  2187. * @enum:
  2188. * FT_LOAD_TARGET_XXX
  2189. *
  2190. * @description:
  2191. * A list of values that are used to select a specific hinting algorithm
  2192. * to use by the hinter. You should OR one of these values to your
  2193. * `load_flags' when calling @FT_Load_Glyph.
  2194. *
  2195. * Note that font's native hinters may ignore the hinting algorithm you
  2196. * have specified (e.g., the TrueType bytecode interpreter). You can set
  2197. * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
  2198. *
  2199. * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
  2200. * always implies @FT_LOAD_FORCE_AUTOHINT.
  2201. *
  2202. * @values:
  2203. * FT_LOAD_TARGET_NORMAL ::
  2204. * This corresponds to the default hinting algorithm, optimized for
  2205. * standard gray-level rendering. For monochrome output, use
  2206. * @FT_LOAD_TARGET_MONO instead.
  2207. *
  2208. * FT_LOAD_TARGET_LIGHT ::
  2209. * A lighter hinting algorithm for non-monochrome modes. Many
  2210. * generated glyphs are more fuzzy but better resemble its original
  2211. * shape. A bit like rendering on Mac OS X.
  2212. *
  2213. * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
  2214. *
  2215. * FT_LOAD_TARGET_MONO ::
  2216. * Strong hinting algorithm that should only be used for monochrome
  2217. * output. The result is probably unpleasant if the glyph is rendered
  2218. * in non-monochrome modes.
  2219. *
  2220. * FT_LOAD_TARGET_LCD ::
  2221. * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
  2222. * decimated LCD displays.
  2223. *
  2224. * FT_LOAD_TARGET_LCD_V ::
  2225. * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
  2226. * decimated LCD displays.
  2227. *
  2228. * @note:
  2229. * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
  2230. * `load_flags'. They can't be ORed.
  2231. *
  2232. * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
  2233. * corresponding mode (i.e., the mode which matches the used algorithm
  2234. * best) unless @FT_LOAD_MONOCHROME is set.
  2235. *
  2236. * You can use a hinting algorithm that doesn't correspond to the same
  2237. * rendering mode. As an example, it is possible to use the `light'
  2238. * hinting algorithm and have the results rendered in horizontal LCD
  2239. * pixel mode, with code like
  2240. *
  2241. * {
  2242. * FT_Load_Glyph( face, glyph_index,
  2243. * load_flags | FT_LOAD_TARGET_LIGHT );
  2244. *
  2245. * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
  2246. * }
  2247. */
  2248. #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
  2249. #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
  2250. #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
  2251. #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
  2252. #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
  2253. #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
  2254. /*
  2255. * @macro:
  2256. * FT_LOAD_TARGET_MODE
  2257. *
  2258. * @description:
  2259. * Return the @FT_Render_Mode corresponding to a given
  2260. * @FT_LOAD_TARGET_XXX value.
  2261. */
  2262. #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
  2263. /* */
  2264. /*************************************************************************/
  2265. /* */
  2266. /* <Function> */
  2267. /* FT_Set_Transform */
  2268. /* */
  2269. /* <Description> */
  2270. /* A function used to set the transformation that is applied to glyph */
  2271. /* images when they are loaded into a glyph slot through */
  2272. /* @FT_Load_Glyph. */
  2273. /* */
  2274. /* <InOut> */
  2275. /* face :: A handle to the source face object. */
  2276. /* */
  2277. /* <Input> */
  2278. /* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */
  2279. /* the identity matrix. */
  2280. /* delta :: A pointer to the translation vector. Use 0 for the null */
  2281. /* vector. */
  2282. /* */
  2283. /* <Note> */
  2284. /* The transformation is only applied to scalable image formats after */
  2285. /* the glyph has been loaded. It means that hinting is unaltered by */
  2286. /* the transformation and is performed on the character size given in */
  2287. /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
  2288. /* */
  2289. /* Note that this also transforms the `face.glyph.advance' field, but */
  2290. /* *not* the values in `face.glyph.metrics'. */
  2291. /* */
  2292. FT_EXPORT( void )
  2293. FT_Set_Transform( FT_Face face,
  2294. FT_Matrix* matrix,
  2295. FT_Vector* delta );
  2296. /*************************************************************************/
  2297. /* */
  2298. /* <Enum> */
  2299. /* FT_Render_Mode */
  2300. /* */
  2301. /* <Description> */
  2302. /* An enumeration type that lists the render modes supported by */
  2303. /* FreeType 2. Each mode corresponds to a specific type of scanline */
  2304. /* conversion performed on the outline. */
  2305. /* */
  2306. /* For bitmap fonts the `bitmap->pixel_mode' field in the */
  2307. /* @FT_GlyphSlotRec structure gives the format of the returned */
  2308. /* bitmap. */
  2309. /* */
  2310. /* <Values> */
  2311. /* FT_RENDER_MODE_NORMAL :: */
  2312. /* This is the default render mode; it corresponds to 8-bit */
  2313. /* anti-aliased bitmaps, using 256 levels of opacity. */
  2314. /* */
  2315. /* FT_RENDER_MODE_LIGHT :: */
  2316. /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
  2317. /* defined as a separate value because render modes are also used */
  2318. /* indirectly to define hinting algorithm selectors. See */
  2319. /* @FT_LOAD_TARGET_XXX for details. */
  2320. /* */
  2321. /* FT_RENDER_MODE_MONO :: */
  2322. /* This mode corresponds to 1-bit bitmaps. */
  2323. /* */
  2324. /* FT_RENDER_MODE_LCD :: */
  2325. /* This mode corresponds to horizontal RGB and BGR sub-pixel */
  2326. /* displays, like LCD-screens. It produces 8-bit bitmaps that are */
  2327. /* 3 times the width of the original glyph outline in pixels, and */
  2328. /* which use the @FT_PIXEL_MODE_LCD mode. */
  2329. /* */
  2330. /* FT_RENDER_MODE_LCD_V :: */
  2331. /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
  2332. /* (like PDA screens, rotated LCD displays, etc.). It produces */
  2333. /* 8-bit bitmaps that are 3 times the height of the original */
  2334. /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
  2335. /* */
  2336. /* <Note> */
  2337. /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */
  2338. /* _not_ _filtered_ to reduce color-fringes. It is up to the caller */
  2339. /* to perform this pass. */
  2340. /* */
  2341. typedef enum FT_Render_Mode_
  2342. {
  2343. FT_RENDER_MODE_NORMAL = 0,
  2344. FT_RENDER_MODE_LIGHT,
  2345. FT_RENDER_MODE_MONO,
  2346. FT_RENDER_MODE_LCD,
  2347. FT_RENDER_MODE_LCD_V,
  2348. FT_RENDER_MODE_MAX
  2349. } FT_Render_Mode;
  2350. /*************************************************************************/
  2351. /* */
  2352. /* <Enum> */
  2353. /* ft_render_mode_xxx */
  2354. /* */
  2355. /* <Description> */
  2356. /* These constants are deprecated. Use the corresponding */
  2357. /* @FT_Render_Mode values instead. */
  2358. /* */
  2359. /* <Values> */
  2360. /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
  2361. /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
  2362. /* */
  2363. #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
  2364. #define ft_render_mode_mono FT_RENDER_MODE_MONO
  2365. /*************************************************************************/
  2366. /* */
  2367. /* <Function> */
  2368. /* FT_Render_Glyph */
  2369. /* */
  2370. /* <Description> */
  2371. /* Convert a given glyph image to a bitmap. It does so by inspecting */
  2372. /* the glyph image format, finding the relevant renderer, and */
  2373. /* invoking it. */
  2374. /* */
  2375. /* <InOut> */
  2376. /* slot :: A handle to the glyph slot containing the image to */
  2377. /* convert. */
  2378. /* */
  2379. /* <Input> */
  2380. /* render_mode :: This is the render mode used to render the glyph */
  2381. /* image into a bitmap. See @FT_Render_Mode for a */
  2382. /* list of possible values. */
  2383. /* */
  2384. /* <Return> */
  2385. /* FreeType error code. 0 means success. */
  2386. /* */
  2387. FT_EXPORT( FT_Error )
  2388. FT_Render_Glyph( FT_GlyphSlot slot,
  2389. FT_Render_Mode render_mode );
  2390. /*************************************************************************/
  2391. /* */
  2392. /* <Enum> */
  2393. /* FT_Kerning_Mode */
  2394. /* */
  2395. /* <Description> */
  2396. /* An enumeration used to specify which kerning values to return in */
  2397. /* @FT_Get_Kerning. */
  2398. /* */
  2399. /* <Values> */
  2400. /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
  2401. /* distances (value is 0). */
  2402. /* */
  2403. /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
  2404. /* distances. */
  2405. /* */
  2406. /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
  2407. /* units. */
  2408. /* */
  2409. typedef enum FT_Kerning_Mode_
  2410. {
  2411. FT_KERNING_DEFAULT = 0,
  2412. FT_KERNING_UNFITTED,
  2413. FT_KERNING_UNSCALED
  2414. } FT_Kerning_Mode;
  2415. /*************************************************************************/
  2416. /* */
  2417. /* <Const> */
  2418. /* ft_kerning_default */
  2419. /* */
  2420. /* <Description> */
  2421. /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
  2422. /* instead. */
  2423. /* */
  2424. #define ft_kerning_default FT_KERNING_DEFAULT
  2425. /*************************************************************************/
  2426. /* */
  2427. /* <Const> */
  2428. /* ft_kerning_unfitted */
  2429. /* */
  2430. /* <Description> */
  2431. /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
  2432. /* instead. */
  2433. /* */
  2434. #define ft_kerning_unfitted FT_KERNING_UNFITTED
  2435. /*************************************************************************/
  2436. /* */
  2437. /* <Const> */
  2438. /* ft_kerning_unscaled */
  2439. /* */
  2440. /* <Description> */
  2441. /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
  2442. /* instead. */
  2443. /* */
  2444. #define ft_kerning_unscaled FT_KERNING_UNSCALED
  2445. /*************************************************************************/
  2446. /* */
  2447. /* <Function> */
  2448. /* FT_Get_Kerning */
  2449. /* */
  2450. /* <Description> */
  2451. /* Return the kerning vector between two glyphs of a same face. */
  2452. /* */
  2453. /* <Input> */
  2454. /* face :: A handle to a source face object. */
  2455. /* */
  2456. /* left_glyph :: The index of the left glyph in the kern pair. */
  2457. /* */
  2458. /* right_glyph :: The index of the right glyph in the kern pair. */
  2459. /* */
  2460. /* kern_mode :: See @FT_Kerning_Mode for more information. */
  2461. /* Determines the scale and dimension of the returned */
  2462. /* kerning vector. */
  2463. /* */
  2464. /* <Output> */
  2465. /* akerning :: The kerning vector. This is either in font units */
  2466. /* or in pixels (26.6 format) for scalable formats, */
  2467. /* and in pixels for fixed-sizes formats. */
  2468. /* */
  2469. /* <Return> */
  2470. /* FreeType error code. 0 means success. */
  2471. /* */
  2472. /* <Note> */
  2473. /* Only horizontal layouts (left-to-right & right-to-left) are */
  2474. /* supported by this method. Other layouts, or more sophisticated */
  2475. /* kernings, are out of the scope of this API function -- they can be */
  2476. /* implemented through format-specific interfaces. */
  2477. /* */
  2478. FT_EXPORT( FT_Error )
  2479. FT_Get_Kerning( FT_Face face,
  2480. FT_UInt left_glyph,
  2481. FT_UInt right_glyph,
  2482. FT_UInt kern_mode,
  2483. FT_Vector *akerning );
  2484. /*************************************************************************/
  2485. /* */
  2486. /* <Function> */
  2487. /* FT_Get_Track_Kerning */
  2488. /* */
  2489. /* <Description> */
  2490. /* Return the track kerning for a given face object at a given size. */
  2491. /* */
  2492. /* <Input> */
  2493. /* face :: A handle to a source face object. */
  2494. /* */
  2495. /* point_size :: The point size in 16.16 fractional points. */
  2496. /* */
  2497. /* degree :: The degree of tightness. */
  2498. /* */
  2499. /* <Output> */
  2500. /* akerning :: The kerning in 16.16 fractional points. */
  2501. /* */
  2502. /* <Return> */
  2503. /* FreeType error code. 0 means success. */
  2504. /* */
  2505. FT_EXPORT( FT_Error )
  2506. FT_Get_Track_Kerning( FT_Face face,
  2507. FT_Fixed point_size,
  2508. FT_Int degree,
  2509. FT_Fixed* akerning );
  2510. /*************************************************************************/
  2511. /* */
  2512. /* <Function> */
  2513. /* FT_Get_Glyph_Name */
  2514. /* */
  2515. /* <Description> */
  2516. /* Retrieve the ASCII name of a given glyph in a face. This only */
  2517. /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns 1. */
  2518. /* */
  2519. /* <Input> */
  2520. /* face :: A handle to a source face object. */
  2521. /* */
  2522. /* glyph_index :: The glyph index. */
  2523. /* */
  2524. /* buffer_max :: The maximal number of bytes available in the */
  2525. /* buffer. */
  2526. /* */
  2527. /* <Output> */
  2528. /* buffer :: A pointer to a target buffer where the name is */
  2529. /* copied to. */
  2530. /* */
  2531. /* <Return> */
  2532. /* FreeType error code. 0 means success. */
  2533. /* */
  2534. /* <Note> */
  2535. /* An error is returned if the face doesn't provide glyph names or if */
  2536. /* the glyph index is invalid. In all cases of failure, the first */
  2537. /* byte of `buffer' is set to 0 to indicate an empty name. */
  2538. /* */
  2539. /* The glyph name is truncated to fit within the buffer if it is too */
  2540. /* long. The returned string is always zero-terminated. */
  2541. /* */
  2542. /* This function is not compiled within the library if the config */
  2543. /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
  2544. /* `include/freetype/config/ftoptions.h'. */
  2545. /* */
  2546. FT_EXPORT( FT_Error )
  2547. FT_Get_Glyph_Name( FT_Face face,
  2548. FT_UInt glyph_index,
  2549. FT_Pointer buffer,
  2550. FT_UInt buffer_max );
  2551. /*************************************************************************/
  2552. /* */
  2553. /* <Function> */
  2554. /* FT_Get_Postscript_Name */
  2555. /* */
  2556. /* <Description> */
  2557. /* Retrieve the ASCII Postscript name of a given face, if available. */
  2558. /* This only works with Postscript and TrueType fonts. */
  2559. /* */
  2560. /* <Input> */
  2561. /* face :: A handle to the source face object. */
  2562. /* */
  2563. /* <Return> */
  2564. /* A pointer to the face's Postscript name. NULL if unavailable. */
  2565. /* */
  2566. /* <Note> */
  2567. /* The returned pointer is owned by the face and is destroyed with */
  2568. /* it. */
  2569. /* */
  2570. FT_EXPORT( const char* )
  2571. FT_Get_Postscript_Name( FT_Face face );
  2572. /*************************************************************************/
  2573. /* */
  2574. /* <Function> */
  2575. /* FT_Select_Charmap */
  2576. /* */
  2577. /* <Description> */
  2578. /* Select a given charmap by its encoding tag (as listed in */
  2579. /* `freetype.h'). */
  2580. /* */
  2581. /* <InOut> */
  2582. /* face :: A handle to the source face object. */
  2583. /* */
  2584. /* <Input> */
  2585. /* encoding :: A handle to the selected encoding. */
  2586. /* */
  2587. /* <Return> */
  2588. /* FreeType error code. 0 means success. */
  2589. /* */
  2590. /* <Note> */
  2591. /* This function returns an error if no charmap in the face */
  2592. /* corresponds to the encoding queried here. */
  2593. /* */
  2594. /* Because many fonts contain more than a single cmap for Unicode */
  2595. /* encoding, this function has some special code to select the one */
  2596. /* which covers Unicode best. It is thus preferable to */
  2597. /* @FT_Set_Charmap in this case. */
  2598. /* */
  2599. FT_EXPORT( FT_Error )
  2600. FT_Select_Charmap( FT_Face face,
  2601. FT_Encoding encoding );
  2602. /*************************************************************************/
  2603. /* */
  2604. /* <Function> */
  2605. /* FT_Set_Charmap */
  2606. /* */
  2607. /* <Description> */
  2608. /* Select a given charmap for character code to glyph index mapping. */
  2609. /* */
  2610. /* <InOut> */
  2611. /* face :: A handle to the source face object. */
  2612. /* */
  2613. /* <Input> */
  2614. /* charmap :: A handle to the selected charmap. */
  2615. /* */
  2616. /* <Return> */
  2617. /* FreeType error code. 0 means success. */
  2618. /* */
  2619. /* <Note> */
  2620. /* This function returns an error if the charmap is not part of */
  2621. /* the face (i.e., if it is not listed in the `face->charmaps' */
  2622. /* table). */
  2623. /* */
  2624. FT_EXPORT( FT_Error )
  2625. FT_Set_Charmap( FT_Face face,
  2626. FT_CharMap charmap );
  2627. /*************************************************************************
  2628. *
  2629. * @function:
  2630. * FT_Get_Charmap_Index
  2631. *
  2632. * @description:
  2633. * Retrieve index of a given charmap.
  2634. *
  2635. * @input:
  2636. * charmap ::
  2637. * A handle to a charmap.
  2638. *
  2639. * @return:
  2640. * The index into the array of character maps within the face to which
  2641. * `charmap' belongs.
  2642. *
  2643. */
  2644. FT_EXPORT( FT_Int )
  2645. FT_Get_Charmap_Index( FT_CharMap charmap );
  2646. /*************************************************************************/
  2647. /* */
  2648. /* <Function> */
  2649. /* FT_Get_Char_Index */
  2650. /* */
  2651. /* <Description> */
  2652. /* Return the glyph index of a given character code. This function */
  2653. /* uses a charmap object to do the mapping. */
  2654. /* */
  2655. /* <Input> */
  2656. /* face :: A handle to the source face object. */
  2657. /* */
  2658. /* charcode :: The character code. */
  2659. /* */
  2660. /* <Return> */
  2661. /* The glyph index. 0 means `undefined character code'. */
  2662. /* */
  2663. /* <Note> */
  2664. /* If you use FreeType to manipulate the contents of font files */
  2665. /* directly, be aware that the glyph index returned by this function */
  2666. /* doesn't always correspond to the internal indices used within */
  2667. /* the file. This is done to ensure that value 0 always corresponds */
  2668. /* to the `missing glyph'. */
  2669. /* */
  2670. FT_EXPORT( FT_UInt )
  2671. FT_Get_Char_Index( FT_Face face,
  2672. FT_ULong charcode );
  2673. /*************************************************************************/
  2674. /* */
  2675. /* <Function> */
  2676. /* FT_Get_First_Char */
  2677. /* */
  2678. /* <Description> */
  2679. /* This function is used to return the first character code in the */
  2680. /* current charmap of a given face. It also returns the */
  2681. /* corresponding glyph index. */
  2682. /* */
  2683. /* <Input> */
  2684. /* face :: A handle to the source face object. */
  2685. /* */
  2686. /* <Output> */
  2687. /* agindex :: Glyph index of first character code. 0 if charmap is */
  2688. /* empty. */
  2689. /* */
  2690. /* <Return> */
  2691. /* The charmap's first character code. */
  2692. /* */
  2693. /* <Note> */
  2694. /* You should use this function with @FT_Get_Next_Char to be able to */
  2695. /* parse all character codes available in a given charmap. The code */
  2696. /* should look like this: */
  2697. /* */
  2698. /* { */
  2699. /* FT_ULong charcode; */
  2700. /* FT_UInt gindex; */
  2701. /* */
  2702. /* */
  2703. /* charcode = FT_Get_First_Char( face, &gindex ); */
  2704. /* while ( gindex != 0 ) */
  2705. /* { */
  2706. /* ... do something with (charcode,gindex) pair ... */
  2707. /* */
  2708. /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
  2709. /* } */
  2710. /* } */
  2711. /* */
  2712. /* Note that `*agindex' is set to 0 if the charmap is empty. The */
  2713. /* result itself can be 0 in two cases: if the charmap is empty or */
  2714. /* when the value 0 is the first valid character code. */
  2715. /* */
  2716. FT_EXPORT( FT_ULong )
  2717. FT_Get_First_Char( FT_Face face,
  2718. FT_UInt *agindex );
  2719. /*************************************************************************/
  2720. /* */
  2721. /* <Function> */
  2722. /* FT_Get_Next_Char */
  2723. /* */
  2724. /* <Description> */
  2725. /* This function is used to return the next character code in the */
  2726. /* current charmap of a given face following the value `char_code', */
  2727. /* as well as the corresponding glyph index. */
  2728. /* */
  2729. /* <Input> */
  2730. /* face :: A handle to the source face object. */
  2731. /* char_code :: The starting character code. */
  2732. /* */
  2733. /* <Output> */
  2734. /* agindex :: Glyph index of first character code. 0 if charmap */
  2735. /* is empty. */
  2736. /* */
  2737. /* <Return> */
  2738. /* The charmap's next character code. */
  2739. /* */
  2740. /* <Note> */
  2741. /* You should use this function with @FT_Get_First_Char to walk */
  2742. /* over all character codes available in a given charmap. See the */
  2743. /* note for this function for a simple code example. */
  2744. /* */
  2745. /* Note that `*agindex' is set to 0 when there are no more codes in */
  2746. /* the charmap. */
  2747. /* */
  2748. FT_EXPORT( FT_ULong )
  2749. FT_Get_Next_Char( FT_Face face,
  2750. FT_ULong char_code,
  2751. FT_UInt *agindex );
  2752. /*************************************************************************/
  2753. /* */
  2754. /* <Function> */
  2755. /* FT_Get_Name_Index */
  2756. /* */
  2757. /* <Description> */
  2758. /* Return the glyph index of a given glyph name. This function uses */
  2759. /* driver specific objects to do the translation. */
  2760. /* */
  2761. /* <Input> */
  2762. /* face :: A handle to the source face object. */
  2763. /* */
  2764. /* glyph_name :: The glyph name. */
  2765. /* */
  2766. /* <Return> */
  2767. /* The glyph index. 0 means `undefined character code'. */
  2768. /* */
  2769. FT_EXPORT( FT_UInt )
  2770. FT_Get_Name_Index( FT_Face face,
  2771. FT_String* glyph_name );
  2772. /*************************************************************************
  2773. *
  2774. * @macro:
  2775. * FT_SUBGLYPH_FLAG_XXX
  2776. *
  2777. * @description:
  2778. * A list of constants used to describe subglyphs. Please refer to the
  2779. * TrueType specification for the meaning of the various flags.
  2780. *
  2781. * @values:
  2782. * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
  2783. * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
  2784. * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
  2785. * FT_SUBGLYPH_FLAG_SCALE ::
  2786. * FT_SUBGLYPH_FLAG_XY_SCALE ::
  2787. * FT_SUBGLYPH_FLAG_2X2 ::
  2788. * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
  2789. *
  2790. */
  2791. #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
  2792. #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
  2793. #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
  2794. #define FT_SUBGLYPH_FLAG_SCALE 8
  2795. #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
  2796. #define FT_SUBGLYPH_FLAG_2X2 0x80
  2797. #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
  2798. /*************************************************************************
  2799. *
  2800. * @func:
  2801. * FT_Get_SubGlyph_Info
  2802. *
  2803. * @description:
  2804. * Retrieve a description of a given subglyph. Only use it if
  2805. * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE, or an error is
  2806. * returned.
  2807. *
  2808. * @input:
  2809. * glyph ::
  2810. * The source glyph slot.
  2811. *
  2812. * sub_index ::
  2813. * The index of subglyph. Must be less than `glyph->num_subglyphs'.
  2814. *
  2815. * @output:
  2816. * p_index ::
  2817. * The glyph index of the subglyph.
  2818. *
  2819. * p_flags ::
  2820. * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
  2821. *
  2822. * p_arg1 ::
  2823. * The subglyph's first argument (if any).
  2824. *
  2825. * p_arg2 ::
  2826. * The subglyph's second argument (if any).
  2827. *
  2828. * p_transform ::
  2829. * The subglyph transformation (if any).
  2830. *
  2831. * @return:
  2832. * FreeType error code. 0 means success.
  2833. *
  2834. * @note:
  2835. * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
  2836. * interpreted depending on the flags returned in `*p_flags'. See the
  2837. * TrueType specification for details.
  2838. *
  2839. */
  2840. FT_EXPORT( FT_Error )
  2841. FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
  2842. FT_UInt sub_index,
  2843. FT_Int *p_index,
  2844. FT_UInt *p_flags,
  2845. FT_Int *p_arg1,
  2846. FT_Int *p_arg2,
  2847. FT_Matrix *p_transform );
  2848. /*************************************************************************/
  2849. /* */
  2850. /* <Section> */
  2851. /* computations */
  2852. /* */
  2853. /* <Title> */
  2854. /* Computations */
  2855. /* */
  2856. /* <Abstract> */
  2857. /* Crunching fixed numbers and vectors. */
  2858. /* */
  2859. /* <Description> */
  2860. /* This section contains various functions used to perform */
  2861. /* computations on 16.16 fixed-float numbers or 2d vectors. */
  2862. /* */
  2863. /* <Order> */
  2864. /* FT_MulDiv */
  2865. /* FT_MulFix */
  2866. /* FT_DivFix */
  2867. /* FT_RoundFix */
  2868. /* FT_CeilFix */
  2869. /* FT_FloorFix */
  2870. /* FT_Vector_Transform */
  2871. /* FT_Matrix_Multiply */
  2872. /* FT_Matrix_Invert */
  2873. /* */
  2874. /*************************************************************************/
  2875. /*************************************************************************/
  2876. /* */
  2877. /* <Function> */
  2878. /* FT_MulDiv */
  2879. /* */
  2880. /* <Description> */
  2881. /* A very simple function used to perform the computation `(a*b)/c' */
  2882. /* with maximal accuracy (it uses a 64-bit intermediate integer */
  2883. /* whenever necessary). */
  2884. /* */
  2885. /* This function isn't necessarily as fast as some processor specific */
  2886. /* operations, but is at least completely portable. */
  2887. /* */
  2888. /* <Input> */
  2889. /* a :: The first multiplier. */
  2890. /* b :: The second multiplier. */
  2891. /* c :: The divisor. */
  2892. /* */
  2893. /* <Return> */
  2894. /* The result of `(a*b)/c'. This function never traps when trying to */
  2895. /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
  2896. /* on the signs of `a' and `b'. */
  2897. /* */
  2898. FT_EXPORT( FT_Long )
  2899. FT_MulDiv( FT_Long a,
  2900. FT_Long b,
  2901. FT_Long c );
  2902. /*************************************************************************/
  2903. /* */
  2904. /* <Function> */
  2905. /* FT_MulFix */
  2906. /* */
  2907. /* <Description> */
  2908. /* A very simple function used to perform the computation */
  2909. /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
  2910. /* used to multiply a given value by a 16.16 fixed float factor. */
  2911. /* */
  2912. /* <Input> */
  2913. /* a :: The first multiplier. */
  2914. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  2915. /* possible (see note below). */
  2916. /* */
  2917. /* <Return> */
  2918. /* The result of `(a*b)/0x10000'. */
  2919. /* */
  2920. /* <Note> */
  2921. /* This function has been optimized for the case where the absolute */
  2922. /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
  2923. /* As this happens mainly when scaling from notional units to */
  2924. /* fractional pixels in FreeType, it resulted in noticeable speed */
  2925. /* improvements between versions 2.x and 1.x. */
  2926. /* */
  2927. /* As a conclusion, always try to place a 16.16 factor as the */
  2928. /* _second_ argument of this function; this can make a great */
  2929. /* difference. */
  2930. /* */
  2931. FT_EXPORT( FT_Long )
  2932. FT_MulFix( FT_Long a,
  2933. FT_Long b );
  2934. /*************************************************************************/
  2935. /* */
  2936. /* <Function> */
  2937. /* FT_DivFix */
  2938. /* */
  2939. /* <Description> */
  2940. /* A very simple function used to perform the computation */
  2941. /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
  2942. /* used to divide a given value by a 16.16 fixed float factor. */
  2943. /* */
  2944. /* <Input> */
  2945. /* a :: The first multiplier. */
  2946. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  2947. /* possible (see note below). */
  2948. /* */
  2949. /* <Return> */
  2950. /* The result of `(a*0x10000)/b'. */
  2951. /* */
  2952. /* <Note> */
  2953. /* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
  2954. /* 32 bits, then the division is computed directly. Otherwise, we */
  2955. /* use a specialized version of @FT_MulDiv. */
  2956. /* */
  2957. FT_EXPORT( FT_Long )
  2958. FT_DivFix( FT_Long a,
  2959. FT_Long b );
  2960. /*************************************************************************/
  2961. /* */
  2962. /* <Function> */
  2963. /* FT_RoundFix */
  2964. /* */
  2965. /* <Description> */
  2966. /* A very simple function used to round a 16.16 fixed number. */
  2967. /* */
  2968. /* <Input> */
  2969. /* a :: The number to be rounded. */
  2970. /* */
  2971. /* <Return> */
  2972. /* The result of `(a + 0x8000) & -0x10000'. */
  2973. /* */
  2974. FT_EXPORT( FT_Fixed )
  2975. FT_RoundFix( FT_Fixed a );
  2976. /*************************************************************************/
  2977. /* */
  2978. /* <Function> */
  2979. /* FT_CeilFix */
  2980. /* */
  2981. /* <Description> */
  2982. /* A very simple function used to compute the ceiling function of a */
  2983. /* 16.16 fixed number. */
  2984. /* */
  2985. /* <Input> */
  2986. /* a :: The number for which the ceiling function is to be computed. */
  2987. /* */
  2988. /* <Return> */
  2989. /* The result of `(a + 0x10000 - 1) & -0x10000'. */
  2990. /* */
  2991. FT_EXPORT( FT_Fixed )
  2992. FT_CeilFix( FT_Fixed a );
  2993. /*************************************************************************/
  2994. /* */
  2995. /* <Function> */
  2996. /* FT_FloorFix */
  2997. /* */
  2998. /* <Description> */
  2999. /* A very simple function used to compute the floor function of a */
  3000. /* 16.16 fixed number. */
  3001. /* */
  3002. /* <Input> */
  3003. /* a :: The number for which the floor function is to be computed. */
  3004. /* */
  3005. /* <Return> */
  3006. /* The result of `a & -0x10000'. */
  3007. /* */
  3008. FT_EXPORT( FT_Fixed )
  3009. FT_FloorFix( FT_Fixed a );
  3010. /*************************************************************************/
  3011. /* */
  3012. /* <Function> */
  3013. /* FT_Vector_Transform */
  3014. /* */
  3015. /* <Description> */
  3016. /* Transform a single vector through a 2x2 matrix. */
  3017. /* */
  3018. /* <InOut> */
  3019. /* vector :: The target vector to transform. */
  3020. /* */
  3021. /* <Input> */
  3022. /* matrix :: A pointer to the source 2x2 matrix. */
  3023. /* */
  3024. /* <Note> */
  3025. /* The result is undefined if either `vector' or `matrix' is invalid. */
  3026. /* */
  3027. FT_EXPORT( void )
  3028. FT_Vector_Transform( FT_Vector* vec,
  3029. const FT_Matrix* matrix );
  3030. /*************************************************************************/
  3031. /* */
  3032. /* <Section> */
  3033. /* version */
  3034. /* */
  3035. /* <Title> */
  3036. /* FreeType Version */
  3037. /* */
  3038. /* <Abstract> */
  3039. /* Functions and macros related to FreeType versions. */
  3040. /* */
  3041. /* <Description> */
  3042. /* Note that those functions and macros are of limited use because */
  3043. /* even a new release of FreeType with only documentation changes */
  3044. /* increases the version number. */
  3045. /* */
  3046. /*************************************************************************/
  3047. /*************************************************************************
  3048. *
  3049. * @enum:
  3050. * FREETYPE_XXX
  3051. *
  3052. * @description:
  3053. * These three macros identify the FreeType source code version.
  3054. * Use @FT_Library_Version to access them at runtime.
  3055. *
  3056. * @values:
  3057. * FREETYPE_MAJOR :: The major version number.
  3058. * FREETYPE_MINOR :: The minor version number.
  3059. * FREETYPE_PATCH :: The patch level.
  3060. *
  3061. * @note:
  3062. * The version number of FreeType if built as a dynamic link library
  3063. * with the `libtool' package is _not_ controlled by these three
  3064. * macros.
  3065. */
  3066. #define FREETYPE_MAJOR 2
  3067. #define FREETYPE_MINOR 3
  3068. #define FREETYPE_PATCH 5
  3069. /*************************************************************************/
  3070. /* */
  3071. /* <Function> */
  3072. /* FT_Library_Version */
  3073. /* */
  3074. /* <Description> */
  3075. /* Return the version of the FreeType library being used. This is */
  3076. /* useful when dynamically linking to the library, since one cannot */
  3077. /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
  3078. /* @FREETYPE_PATCH. */
  3079. /* */
  3080. /* <Input> */
  3081. /* library :: A source library handle. */
  3082. /* */
  3083. /* <Output> */
  3084. /* amajor :: The major version number. */
  3085. /* */
  3086. /* aminor :: The minor version number. */
  3087. /* */
  3088. /* apatch :: The patch version number. */
  3089. /* */
  3090. /* <Note> */
  3091. /* The reason why this function takes a `library' argument is because */
  3092. /* certain programs implement library initialization in a custom way */
  3093. /* that doesn't use @FT_Init_FreeType. */
  3094. /* */
  3095. /* In such cases, the library version might not be available before */
  3096. /* the library object has been created. */
  3097. /* */
  3098. FT_EXPORT( void )
  3099. FT_Library_Version( FT_Library library,
  3100. FT_Int *amajor,
  3101. FT_Int *aminor,
  3102. FT_Int *apatch );
  3103. /*************************************************************************/
  3104. /* */
  3105. /* <Function> */
  3106. /* FT_Face_CheckTrueTypePatents */
  3107. /* */
  3108. /* <Description> */
  3109. /* Parse all bytecode instructions of a TrueType font file to check */
  3110. /* whether any of the patented opcodes are used. This is only useful */
  3111. /* if you want to be able to use the unpatented hinter with */
  3112. /* fonts that do *not* use these opcodes. */
  3113. /* */
  3114. /* Note that this function parses *all* glyph instructions in the */
  3115. /* font file, which may be slow. */
  3116. /* */
  3117. /* <Input> */
  3118. /* face :: A face handle. */
  3119. /* */
  3120. /* <Return> */
  3121. /* 1 if this is a TrueType font that uses one of the patented */
  3122. /* opcodes, 0 otherwise. */
  3123. /* */
  3124. /* <Since> */
  3125. /* 2.3.5 */
  3126. /* */
  3127. FT_EXPORT( FT_Bool )
  3128. FT_Face_CheckTrueTypePatents( FT_Face face );
  3129. /*************************************************************************/
  3130. /* */
  3131. /* <Function> */
  3132. /* FT_Face_SetUnpatentedHinting */
  3133. /* */
  3134. /* <Description> */
  3135. /* Enable or disable the unpatented hinter for a given face. */
  3136. /* Only enable it if you have determined that the face doesn't */
  3137. /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
  3138. /* */
  3139. /* <Input> */
  3140. /* face :: A face handle. */
  3141. /* */
  3142. /* value :: New boolean setting. */
  3143. /* */
  3144. /* <Return> */
  3145. /* The old setting value. This will always be false if this is not */
  3146. /* a SFNT font, or if the unpatented hinter is not compiled in this */
  3147. /* instance of the library. */
  3148. /* */
  3149. /* <Since> */
  3150. /* 2.3.5 */
  3151. /* */
  3152. FT_EXPORT( FT_Bool )
  3153. FT_Face_SetUnpatentedHinting( FT_Face face,
  3154. FT_Bool value );
  3155. /* */
  3156. FT_END_HEADER
  3157. #endif /* __FREETYPE_H__ */
  3158. /* END */