freetype.h 250 KB

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