freetype.h 249 KB

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