freetype.h 248 KB

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