freetype.h 238 KB

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