FreeTypeAmalgam.h 581 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276
  1. /***************************************************************************/
  2. /* */
  3. /* FreeTypeAmalgam.h */
  4. /* */
  5. /* Copyright 2003-2007, 2011 by */
  6. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  7. /* */
  8. /* This file is part of the FreeType project, and may only be used, */
  9. /* modified, and distributed under the terms of the FreeType project */
  10. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  11. /* this file you indicate that you have read the license and */
  12. /* understand and accept it fully. */
  13. /* */
  14. /***************************************************************************/
  15. #ifdef _MSC_VER
  16. #pragma push_macro("_CRT_SECURE_NO_WARNINGS")
  17. #ifndef _CRT_SECURE_NO_WARNINGS
  18. #define _CRT_SECURE_NO_WARNINGS
  19. #endif
  20. #endif
  21. /*** Start of inlined file: ft2build.h ***/
  22. /* */
  23. /* ft2build.h */
  24. /* */
  25. /* FreeType 2 build and setup macros. */
  26. /* (Generic version) */
  27. /* */
  28. /* Copyright 1996-2001, 2006 by */
  29. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  30. /* */
  31. /* This file is part of the FreeType project, and may only be used, */
  32. /* modified, and distributed under the terms of the FreeType project */
  33. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  34. /* this file you indicate that you have read the license and */
  35. /* understand and accept it fully. */
  36. /* */
  37. /***************************************************************************/
  38. /*************************************************************************/
  39. /* */
  40. /* This file corresponds to the default `ft2build.h' file for */
  41. /* FreeType 2. It uses the `freetype' include root. */
  42. /* */
  43. /* Note that specific platforms might use a different configuration. */
  44. /* See builds/unix/ft2unix.h for an example. */
  45. /* */
  46. /*************************************************************************/
  47. #ifndef __FT2_BUILD_GENERIC_H__
  48. #define __FT2_BUILD_GENERIC_H__
  49. /*** Start of inlined file: ftheader.h ***/
  50. /* */
  51. /* ftheader.h */
  52. /* */
  53. /* Build macros of the FreeType 2 library. */
  54. /* */
  55. /* Copyright 1996-2008, 2010, 2012, 2013 by */
  56. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  57. /* */
  58. /* This file is part of the FreeType project, and may only be used, */
  59. /* modified, and distributed under the terms of the FreeType project */
  60. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  61. /* this file you indicate that you have read the license and */
  62. /* understand and accept it fully. */
  63. /* */
  64. /***************************************************************************/
  65. #ifndef __FT_HEADER_H__
  66. #define __FT_HEADER_H__
  67. /*@***********************************************************************/
  68. /* */
  69. /* <Macro> */
  70. /* FT_BEGIN_HEADER */
  71. /* */
  72. /* <Description> */
  73. /* This macro is used in association with @FT_END_HEADER in header */
  74. /* files to ensure that the declarations within are properly */
  75. /* encapsulated in an `extern "C" { .. }' block when included from a */
  76. /* C++ compiler. */
  77. /* */
  78. #ifdef __cplusplus
  79. #define FT_BEGIN_HEADER extern "C" {
  80. #else
  81. #define FT_BEGIN_HEADER /* nothing */
  82. #endif
  83. /*@***********************************************************************/
  84. /* */
  85. /* <Macro> */
  86. /* FT_END_HEADER */
  87. /* */
  88. /* <Description> */
  89. /* This macro is used in association with @FT_BEGIN_HEADER in header */
  90. /* files to ensure that the declarations within are properly */
  91. /* encapsulated in an `extern "C" { .. }' block when included from a */
  92. /* C++ compiler. */
  93. /* */
  94. #ifdef __cplusplus
  95. #define FT_END_HEADER }
  96. #else
  97. #define FT_END_HEADER /* nothing */
  98. #endif
  99. /*************************************************************************/
  100. /* */
  101. /* Aliases for the FreeType 2 public and configuration files. */
  102. /* */
  103. /*************************************************************************/
  104. /*************************************************************************/
  105. /* */
  106. /* <Section> */
  107. /* header_file_macros */
  108. /* */
  109. /* <Title> */
  110. /* Header File Macros */
  111. /* */
  112. /* <Abstract> */
  113. /* Macro definitions used to #include specific header files. */
  114. /* */
  115. /* <Description> */
  116. /* The following macros are defined to the name of specific */
  117. /* FreeType~2 header files. They can be used directly in #include */
  118. /* statements as in: */
  119. /* */
  120. /* { */
  121. /* #include FT_FREETYPE_H */
  122. /* #include FT_MULTIPLE_MASTERS_H */
  123. /* #include FT_GLYPH_H */
  124. /* } */
  125. /* */
  126. /* There are several reasons why we are now using macros to name */
  127. /* public header files. The first one is that such macros are not */
  128. /* limited to the infamous 8.3~naming rule required by DOS (and */
  129. /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
  130. /* */
  131. /* The second reason is that it allows for more flexibility in the */
  132. /* way FreeType~2 is installed on a given system. */
  133. /* */
  134. /*************************************************************************/
  135. /* configuration files */
  136. /*************************************************************************
  137. *
  138. * @macro:
  139. * FT_CONFIG_CONFIG_H
  140. *
  141. * @description:
  142. * A macro used in #include statements to name the file containing
  143. * FreeType~2 configuration data.
  144. *
  145. */
  146. #ifndef FT_CONFIG_CONFIG_H
  147. #define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h>
  148. #endif
  149. /*************************************************************************
  150. *
  151. * @macro:
  152. * FT_CONFIG_STANDARD_LIBRARY_H
  153. *
  154. * @description:
  155. * A macro used in #include statements to name the file containing
  156. * FreeType~2 interface to the standard C library functions.
  157. *
  158. */
  159. #ifndef FT_CONFIG_STANDARD_LIBRARY_H
  160. #define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
  161. #endif
  162. /*************************************************************************
  163. *
  164. * @macro:
  165. * FT_CONFIG_OPTIONS_H
  166. *
  167. * @description:
  168. * A macro used in #include statements to name the file containing
  169. * FreeType~2 project-specific configuration options.
  170. *
  171. */
  172. #ifndef FT_CONFIG_OPTIONS_H
  173. #define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
  174. #endif
  175. /*************************************************************************
  176. *
  177. * @macro:
  178. * FT_CONFIG_MODULES_H
  179. *
  180. * @description:
  181. * A macro used in #include statements to name the file containing the
  182. * list of FreeType~2 modules that are statically linked to new library
  183. * instances in @FT_Init_FreeType.
  184. *
  185. */
  186. #ifndef FT_CONFIG_MODULES_H
  187. #define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
  188. #endif
  189. /* */
  190. /* public headers */
  191. /*************************************************************************
  192. *
  193. * @macro:
  194. * FT_FREETYPE_H
  195. *
  196. * @description:
  197. * A macro used in #include statements to name the file containing the
  198. * base FreeType~2 API.
  199. *
  200. */
  201. #define FT_FREETYPE_H <stdio.h> //<freetype/freetype.h>
  202. /*************************************************************************
  203. *
  204. * @macro:
  205. * FT_ERRORS_H
  206. *
  207. * @description:
  208. * A macro used in #include statements to name the file containing the
  209. * list of FreeType~2 error codes (and messages).
  210. *
  211. * It is included by @FT_FREETYPE_H.
  212. *
  213. */
  214. #define FT_ERRORS_H <freetype/fterrors.h>
  215. /*************************************************************************
  216. *
  217. * @macro:
  218. * FT_MODULE_ERRORS_H
  219. *
  220. * @description:
  221. * A macro used in #include statements to name the file containing the
  222. * list of FreeType~2 module error offsets (and messages).
  223. *
  224. */
  225. #define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
  226. /*************************************************************************
  227. *
  228. * @macro:
  229. * FT_SYSTEM_H
  230. *
  231. * @description:
  232. * A macro used in #include statements to name the file containing the
  233. * FreeType~2 interface to low-level operations (i.e., memory management
  234. * and stream i/o).
  235. *
  236. * It is included by @FT_FREETYPE_H.
  237. *
  238. */
  239. #define FT_SYSTEM_H <freetype/ftsystem.h>
  240. /*************************************************************************
  241. *
  242. * @macro:
  243. * FT_IMAGE_H
  244. *
  245. * @description:
  246. * A macro used in #include statements to name the file containing type
  247. * definitions related to glyph images (i.e., bitmaps, outlines,
  248. * scan-converter parameters).
  249. *
  250. * It is included by @FT_FREETYPE_H.
  251. *
  252. */
  253. #define FT_IMAGE_H <freetype/ftimage.h>
  254. /*************************************************************************
  255. *
  256. * @macro:
  257. * FT_TYPES_H
  258. *
  259. * @description:
  260. * A macro used in #include statements to name the file containing the
  261. * basic data types defined by FreeType~2.
  262. *
  263. * It is included by @FT_FREETYPE_H.
  264. *
  265. */
  266. #define FT_TYPES_H <freetype/fttypes.h>
  267. /*************************************************************************
  268. *
  269. * @macro:
  270. * FT_LIST_H
  271. *
  272. * @description:
  273. * A macro used in #include statements to name the file containing the
  274. * list management API of FreeType~2.
  275. *
  276. * (Most applications will never need to include this file.)
  277. *
  278. */
  279. #define FT_LIST_H <freetype/ftlist.h>
  280. /*************************************************************************
  281. *
  282. * @macro:
  283. * FT_OUTLINE_H
  284. *
  285. * @description:
  286. * A macro used in #include statements to name the file containing the
  287. * scalable outline management API of FreeType~2.
  288. *
  289. */
  290. #define FT_OUTLINE_H <freetype/ftoutln.h>
  291. /*************************************************************************
  292. *
  293. * @macro:
  294. * FT_SIZES_H
  295. *
  296. * @description:
  297. * A macro used in #include statements to name the file containing the
  298. * API which manages multiple @FT_Size objects per face.
  299. *
  300. */
  301. #define FT_SIZES_H <freetype/ftsizes.h>
  302. /*************************************************************************
  303. *
  304. * @macro:
  305. * FT_MODULE_H
  306. *
  307. * @description:
  308. * A macro used in #include statements to name the file containing the
  309. * module management API of FreeType~2.
  310. *
  311. */
  312. #define FT_MODULE_H <freetype/ftmodapi.h>
  313. /*************************************************************************
  314. *
  315. * @macro:
  316. * FT_RENDER_H
  317. *
  318. * @description:
  319. * A macro used in #include statements to name the file containing the
  320. * renderer module management API of FreeType~2.
  321. *
  322. */
  323. #define FT_RENDER_H <freetype/ftrender.h>
  324. /*************************************************************************
  325. *
  326. * @macro:
  327. * FT_AUTOHINTER_H
  328. *
  329. * @description:
  330. * A macro used in #include statements to name the file containing
  331. * structures and macros related to the auto-hinting module.
  332. *
  333. */
  334. #define FT_AUTOHINTER_H <freetype/ftautoh.h>
  335. /*************************************************************************
  336. *
  337. * @macro:
  338. * FT_CFF_DRIVER_H
  339. *
  340. * @description:
  341. * A macro used in #include statements to name the file containing
  342. * structures and macros related to the CFF driver module.
  343. *
  344. */
  345. #define FT_CFF_DRIVER_H <freetype/ftcffdrv.h>
  346. /*************************************************************************
  347. *
  348. * @macro:
  349. * FT_TYPE1_TABLES_H
  350. *
  351. * @description:
  352. * A macro used in #include statements to name the file containing the
  353. * types and API specific to the Type~1 format.
  354. *
  355. */
  356. #define FT_TYPE1_TABLES_H <freetype/t1tables.h>
  357. /*************************************************************************
  358. *
  359. * @macro:
  360. * FT_TRUETYPE_IDS_H
  361. *
  362. * @description:
  363. * A macro used in #include statements to name the file containing the
  364. * enumeration values which identify name strings, languages, encodings,
  365. * etc. This file really contains a _large_ set of constant macro
  366. * definitions, taken from the TrueType and OpenType specifications.
  367. *
  368. */
  369. #define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
  370. /*************************************************************************
  371. *
  372. * @macro:
  373. * FT_TRUETYPE_TABLES_H
  374. *
  375. * @description:
  376. * A macro used in #include statements to name the file containing the
  377. * types and API specific to the TrueType (as well as OpenType) format.
  378. *
  379. */
  380. #define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
  381. /*************************************************************************
  382. *
  383. * @macro:
  384. * FT_TRUETYPE_TAGS_H
  385. *
  386. * @description:
  387. * A macro used in #include statements to name the file containing the
  388. * definitions of TrueType four-byte `tags' which identify blocks in
  389. * SFNT-based font formats (i.e., TrueType and OpenType).
  390. *
  391. */
  392. #define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
  393. /*************************************************************************
  394. *
  395. * @macro:
  396. * FT_BDF_H
  397. *
  398. * @description:
  399. * A macro used in #include statements to name the file containing the
  400. * definitions of an API which accesses BDF-specific strings from a
  401. * face.
  402. *
  403. */
  404. #define FT_BDF_H <freetype/ftbdf.h>
  405. /*************************************************************************
  406. *
  407. * @macro:
  408. * FT_CID_H
  409. *
  410. * @description:
  411. * A macro used in #include statements to name the file containing the
  412. * definitions of an API which access CID font information from a
  413. * face.
  414. *
  415. */
  416. #define FT_CID_H <freetype/ftcid.h>
  417. /*************************************************************************
  418. *
  419. * @macro:
  420. * FT_GZIP_H
  421. *
  422. * @description:
  423. * A macro used in #include statements to name the file containing the
  424. * definitions of an API which supports gzip-compressed files.
  425. *
  426. */
  427. #define FT_GZIP_H <freetype/ftgzip.h>
  428. /*************************************************************************
  429. *
  430. * @macro:
  431. * FT_LZW_H
  432. *
  433. * @description:
  434. * A macro used in #include statements to name the file containing the
  435. * definitions of an API which supports LZW-compressed files.
  436. *
  437. */
  438. #define FT_LZW_H <freetype/ftlzw.h>
  439. /*************************************************************************
  440. *
  441. * @macro:
  442. * FT_BZIP2_H
  443. *
  444. * @description:
  445. * A macro used in #include statements to name the file containing the
  446. * definitions of an API which supports bzip2-compressed files.
  447. *
  448. */
  449. #define FT_BZIP2_H <freetype/ftbzip2.h>
  450. /*************************************************************************
  451. *
  452. * @macro:
  453. * FT_WINFONTS_H
  454. *
  455. * @description:
  456. * A macro used in #include statements to name the file containing the
  457. * definitions of an API which supports Windows FNT files.
  458. *
  459. */
  460. #define FT_WINFONTS_H <freetype/ftwinfnt.h>
  461. /*************************************************************************
  462. *
  463. * @macro:
  464. * FT_GLYPH_H
  465. *
  466. * @description:
  467. * A macro used in #include statements to name the file containing the
  468. * API of the optional glyph management component.
  469. *
  470. */
  471. #define FT_GLYPH_H <freetype/ftglyph.h>
  472. /*************************************************************************
  473. *
  474. * @macro:
  475. * FT_BITMAP_H
  476. *
  477. * @description:
  478. * A macro used in #include statements to name the file containing the
  479. * API of the optional bitmap conversion component.
  480. *
  481. */
  482. #define FT_BITMAP_H <freetype/ftbitmap.h>
  483. /*************************************************************************
  484. *
  485. * @macro:
  486. * FT_BBOX_H
  487. *
  488. * @description:
  489. * A macro used in #include statements to name the file containing the
  490. * API of the optional exact bounding box computation routines.
  491. *
  492. */
  493. #define FT_BBOX_H <freetype/ftbbox.h>
  494. /*************************************************************************
  495. *
  496. * @macro:
  497. * FT_CACHE_H
  498. *
  499. * @description:
  500. * A macro used in #include statements to name the file containing the
  501. * API of the optional FreeType~2 cache sub-system.
  502. *
  503. */
  504. #define FT_CACHE_H <freetype/ftcache.h>
  505. /*************************************************************************
  506. *
  507. * @macro:
  508. * FT_CACHE_IMAGE_H
  509. *
  510. * @description:
  511. * A macro used in #include statements to name the file containing the
  512. * `glyph image' API of the FreeType~2 cache sub-system.
  513. *
  514. * It is used to define a cache for @FT_Glyph elements. You can also
  515. * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
  516. * store small glyph bitmaps, as it will use less memory.
  517. *
  518. * This macro is deprecated. Simply include @FT_CACHE_H to have all
  519. * glyph image-related cache declarations.
  520. *
  521. */
  522. #define FT_CACHE_IMAGE_H FT_CACHE_H
  523. /*************************************************************************
  524. *
  525. * @macro:
  526. * FT_CACHE_SMALL_BITMAPS_H
  527. *
  528. * @description:
  529. * A macro used in #include statements to name the file containing the
  530. * `small bitmaps' API of the FreeType~2 cache sub-system.
  531. *
  532. * It is used to define a cache for small glyph bitmaps in a relatively
  533. * memory-efficient way. You can also use the API defined in
  534. * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,
  535. * including scalable outlines.
  536. *
  537. * This macro is deprecated. Simply include @FT_CACHE_H to have all
  538. * small bitmaps-related cache declarations.
  539. *
  540. */
  541. #define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
  542. /*************************************************************************
  543. *
  544. * @macro:
  545. * FT_CACHE_CHARMAP_H
  546. *
  547. * @description:
  548. * A macro used in #include statements to name the file containing the
  549. * `charmap' API of the FreeType~2 cache sub-system.
  550. *
  551. * This macro is deprecated. Simply include @FT_CACHE_H to have all
  552. * charmap-based cache declarations.
  553. *
  554. */
  555. #define FT_CACHE_CHARMAP_H FT_CACHE_H
  556. /*************************************************************************
  557. *
  558. * @macro:
  559. * FT_MAC_H
  560. *
  561. * @description:
  562. * A macro used in #include statements to name the file containing the
  563. * Macintosh-specific FreeType~2 API. The latter is used to access
  564. * fonts embedded in resource forks.
  565. *
  566. * This header file must be explicitly included by client applications
  567. * compiled on the Mac (note that the base API still works though).
  568. *
  569. */
  570. #define FT_MAC_H <freetype/ftmac.h>
  571. /*************************************************************************
  572. *
  573. * @macro:
  574. * FT_MULTIPLE_MASTERS_H
  575. *
  576. * @description:
  577. * A macro used in #include statements to name the file containing the
  578. * optional multiple-masters management API of FreeType~2.
  579. *
  580. */
  581. #define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
  582. /*************************************************************************
  583. *
  584. * @macro:
  585. * FT_SFNT_NAMES_H
  586. *
  587. * @description:
  588. * A macro used in #include statements to name the file containing the
  589. * optional FreeType~2 API which accesses embedded `name' strings in
  590. * SFNT-based font formats (i.e., TrueType and OpenType).
  591. *
  592. */
  593. #define FT_SFNT_NAMES_H <freetype/ftsnames.h>
  594. /*************************************************************************
  595. *
  596. * @macro:
  597. * FT_OPENTYPE_VALIDATE_H
  598. *
  599. * @description:
  600. * A macro used in #include statements to name the file containing the
  601. * optional FreeType~2 API which validates OpenType tables (BASE, GDEF,
  602. * GPOS, GSUB, JSTF).
  603. *
  604. */
  605. #define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
  606. /*************************************************************************
  607. *
  608. * @macro:
  609. * FT_GX_VALIDATE_H
  610. *
  611. * @description:
  612. * A macro used in #include statements to name the file containing the
  613. * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,
  614. * mort, morx, bsln, just, kern, opbd, trak, prop).
  615. *
  616. */
  617. #define FT_GX_VALIDATE_H <freetype/ftgxval.h>
  618. /*************************************************************************
  619. *
  620. * @macro:
  621. * FT_PFR_H
  622. *
  623. * @description:
  624. * A macro used in #include statements to name the file containing the
  625. * FreeType~2 API which accesses PFR-specific data.
  626. *
  627. */
  628. #define FT_PFR_H <freetype/ftpfr.h>
  629. /*************************************************************************
  630. *
  631. * @macro:
  632. * FT_STROKER_H
  633. *
  634. * @description:
  635. * A macro used in #include statements to name the file containing the
  636. * FreeType~2 API which provides functions to stroke outline paths.
  637. */
  638. #define FT_STROKER_H <freetype/ftstroke.h>
  639. /*************************************************************************
  640. *
  641. * @macro:
  642. * FT_SYNTHESIS_H
  643. *
  644. * @description:
  645. * A macro used in #include statements to name the file containing the
  646. * FreeType~2 API which performs artificial obliquing and emboldening.
  647. */
  648. #define FT_SYNTHESIS_H <freetype/ftsynth.h>
  649. /*************************************************************************
  650. *
  651. * @macro:
  652. * FT_XFREE86_H
  653. *
  654. * @description:
  655. * A macro used in #include statements to name the file containing the
  656. * FreeType~2 API which provides functions specific to the XFree86 and
  657. * X.Org X11 servers.
  658. */
  659. #define FT_XFREE86_H <freetype/ftxf86.h>
  660. /*************************************************************************
  661. *
  662. * @macro:
  663. * FT_TRIGONOMETRY_H
  664. *
  665. * @description:
  666. * A macro used in #include statements to name the file containing the
  667. * FreeType~2 API which performs trigonometric computations (e.g.,
  668. * cosines and arc tangents).
  669. */
  670. #define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
  671. /*************************************************************************
  672. *
  673. * @macro:
  674. * FT_LCD_FILTER_H
  675. *
  676. * @description:
  677. * A macro used in #include statements to name the file containing the
  678. * FreeType~2 API which performs color filtering for subpixel rendering.
  679. */
  680. #define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
  681. /*************************************************************************
  682. *
  683. * @macro:
  684. * FT_UNPATENTED_HINTING_H
  685. *
  686. * @description:
  687. * A macro used in #include statements to name the file containing the
  688. * FreeType~2 API which performs color filtering for subpixel rendering.
  689. */
  690. #define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h>
  691. /*************************************************************************
  692. *
  693. * @macro:
  694. * FT_INCREMENTAL_H
  695. *
  696. * @description:
  697. * A macro used in #include statements to name the file containing the
  698. * FreeType~2 API which performs color filtering for subpixel rendering.
  699. */
  700. #define FT_INCREMENTAL_H <freetype/ftincrem.h>
  701. /*************************************************************************
  702. *
  703. * @macro:
  704. * FT_GASP_H
  705. *
  706. * @description:
  707. * A macro used in #include statements to name the file containing the
  708. * FreeType~2 API which returns entries from the TrueType GASP table.
  709. */
  710. #define FT_GASP_H <freetype/ftgasp.h>
  711. /*************************************************************************
  712. *
  713. * @macro:
  714. * FT_ADVANCES_H
  715. *
  716. * @description:
  717. * A macro used in #include statements to name the file containing the
  718. * FreeType~2 API which returns individual and ranged glyph advances.
  719. */
  720. #define FT_ADVANCES_H <freetype/ftadvanc.h>
  721. /* */
  722. #define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
  723. /* The internals of the cache sub-system are no longer exposed. We */
  724. /* default to FT_CACHE_H at the moment just in case, but we know of */
  725. /* no rogue client that uses them. */
  726. /* */
  727. #define FT_CACHE_MANAGER_H <freetype/ftcache.h>
  728. #define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h>
  729. #define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h>
  730. #define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h>
  731. #define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h>
  732. #define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h>
  733. #define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h>
  734. #define FT_INCREMENTAL_H <freetype/ftincrem.h>
  735. #define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
  736. /*
  737. * Include internal headers definitions from <freetype/internal/...>
  738. * only when building the library.
  739. */
  740. #ifdef FT2_BUILD_LIBRARY
  741. #define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
  742. /*** Start of inlined file: internal.h ***/
  743. /* */
  744. /* internal.h */
  745. /* */
  746. /* Internal header files (specification only). */
  747. /* */
  748. /* Copyright 1996-2001, 2002, 2003, 2004 by */
  749. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  750. /* */
  751. /* This file is part of the FreeType project, and may only be used, */
  752. /* modified, and distributed under the terms of the FreeType project */
  753. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  754. /* this file you indicate that you have read the license and */
  755. /* understand and accept it fully. */
  756. /* */
  757. /***************************************************************************/
  758. /*************************************************************************/
  759. /* */
  760. /* This file is automatically included by `ft2build.h'. */
  761. /* Do not include it manually! */
  762. /* */
  763. /*************************************************************************/
  764. #define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
  765. #define FT_INTERNAL_PIC_H <freetype/internal/ftpic.h>
  766. #define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
  767. #define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
  768. #define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
  769. #define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
  770. #define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
  771. #define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
  772. #define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
  773. #define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
  774. #define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h>
  775. #define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h>
  776. #define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h>
  777. #define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
  778. #define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
  779. #define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
  780. #define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
  781. #define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
  782. #define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
  783. /* END */
  784. /*** End of inlined file: internal.h ***/
  785. #endif /* FT2_BUILD_LIBRARY */
  786. #endif /* __FT2_BUILD_H__ */
  787. /* END */
  788. /*** End of inlined file: ftheader.h ***/
  789. #endif /* __FT2_BUILD_GENERIC_H__ */
  790. /* END */
  791. /*** End of inlined file: ft2build.h ***/
  792. /*** Start of inlined file: freetype.h ***/
  793. /* */
  794. /* freetype.h */
  795. /* */
  796. /* FreeType high-level API and common types (specification only). */
  797. /* */
  798. /* Copyright 1996-2013 by */
  799. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  800. /* */
  801. /* This file is part of the FreeType project, and may only be used, */
  802. /* modified, and distributed under the terms of the FreeType project */
  803. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  804. /* this file you indicate that you have read the license and */
  805. /* understand and accept it fully. */
  806. /* */
  807. /***************************************************************************/
  808. #ifndef __FREETYPE_H__
  809. #define __FREETYPE_H__
  810. #ifndef FT_FREETYPE_H
  811. #error "`ft2build.h' hasn't been included yet!"
  812. #error "Please always use macros to include FreeType header files."
  813. #error "Example:"
  814. #error " #include <ft2build.h>"
  815. #error " #include FT_FREETYPE_H"
  816. #endif
  817. /*** Start of inlined file: ftconfig.h ***/
  818. /* */
  819. /* ftconfig.h */
  820. /* */
  821. /* ANSI-specific configuration file (specification only). */
  822. /* */
  823. /* Copyright 1996-2004, 2006-2008, 2010-2011, 2013 by */
  824. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  825. /* */
  826. /* This file is part of the FreeType project, and may only be used, */
  827. /* modified, and distributed under the terms of the FreeType project */
  828. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  829. /* this file you indicate that you have read the license and */
  830. /* understand and accept it fully. */
  831. /* */
  832. /***************************************************************************/
  833. /*************************************************************************/
  834. /* */
  835. /* This header file contains a number of macro definitions that are used */
  836. /* by the rest of the engine. Most of the macros here are automatically */
  837. /* determined at compile time, and you should not need to change it to */
  838. /* port FreeType, except to compile the library with a non-ANSI */
  839. /* compiler. */
  840. /* */
  841. /* Note however that if some specific modifications are needed, we */
  842. /* advise you to place a modified copy in your build directory. */
  843. /* */
  844. /* The build directory is usually `freetype/builds/<system>', and */
  845. /* contains system-specific files that are always included first when */
  846. /* building the library. */
  847. /* */
  848. /* This ANSI version should stay in `include/freetype/config'. */
  849. /* */
  850. /*************************************************************************/
  851. #ifndef __FTCONFIG_H__
  852. #define __FTCONFIG_H__
  853. /*** Start of inlined file: ftoption.h ***/
  854. /* */
  855. /* ftoption.h */
  856. /* */
  857. /* User-selectable configuration macros (specification only). */
  858. /* */
  859. /* Copyright 1996-2013 by */
  860. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  861. /* */
  862. /* This file is part of the FreeType project, and may only be used, */
  863. /* modified, and distributed under the terms of the FreeType project */
  864. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  865. /* this file you indicate that you have read the license and */
  866. /* understand and accept it fully. */
  867. /* */
  868. /***************************************************************************/
  869. #ifndef __FTOPTION_H__
  870. #define __FTOPTION_H__
  871. FT_BEGIN_HEADER
  872. /*************************************************************************/
  873. /* */
  874. /* USER-SELECTABLE CONFIGURATION MACROS */
  875. /* */
  876. /* This file contains the default configuration macro definitions for */
  877. /* a standard build of the FreeType library. There are three ways to */
  878. /* use this file to build project-specific versions of the library: */
  879. /* */
  880. /* - You can modify this file by hand, but this is not recommended in */
  881. /* cases where you would like to build several versions of the */
  882. /* library from a single source directory. */
  883. /* */
  884. /* - You can put a copy of this file in your build directory, more */
  885. /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */
  886. /* is the name of a directory that is included _before_ the FreeType */
  887. /* include path during compilation. */
  888. /* */
  889. /* The default FreeType Makefiles and Jamfiles use the build */
  890. /* directory `builds/<system>' by default, but you can easily change */
  891. /* that for your own projects. */
  892. /* */
  893. /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */
  894. /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */
  895. /* locate this file during the build. For example, */
  896. /* */
  897. /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
  898. /* #include <freetype/config/ftheader.h> */
  899. /* */
  900. /* will use `$BUILD/myftoptions.h' instead of this file for macro */
  901. /* definitions. */
  902. /* */
  903. /* Note also that you can similarly pre-define the macro */
  904. /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */
  905. /* that are statically linked to the library at compile time. By */
  906. /* default, this file is <freetype/config/ftmodule.h>. */
  907. /* */
  908. /* We highly recommend using the third method whenever possible. */
  909. /* */
  910. /*************************************************************************/
  911. /*************************************************************************/
  912. /*************************************************************************/
  913. /**** ****/
  914. /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
  915. /**** ****/
  916. /*************************************************************************/
  917. /*************************************************************************/
  918. /*************************************************************************/
  919. /* */
  920. /* Uncomment the line below if you want to activate sub-pixel rendering */
  921. /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */
  922. /* */
  923. /* Note that this feature is covered by several Microsoft patents */
  924. /* and should not be activated in any default build of the library. */
  925. /* */
  926. /* This macro has no impact on the FreeType API, only on its */
  927. /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
  928. /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
  929. /* the original size in case this macro isn't defined; however, each */
  930. /* triplet of subpixels has R=G=B. */
  931. /* */
  932. /* This is done to allow FreeType clients to run unmodified, forcing */
  933. /* them to display normal gray-level anti-aliased glyphs. */
  934. /* */
  935. /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
  936. /*************************************************************************/
  937. /* */
  938. /* Many compilers provide a non-ANSI 64-bit data type that can be used */
  939. /* by FreeType to speed up some computations. However, this will create */
  940. /* some problems when compiling the library in strict ANSI mode. */
  941. /* */
  942. /* For this reason, the use of 64-bit integers is normally disabled when */
  943. /* the __STDC__ macro is defined. You can however disable this by */
  944. /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */
  945. /* */
  946. /* For most compilers, this will only create compilation warnings when */
  947. /* building the library. */
  948. /* */
  949. /* ObNote: The compiler-specific 64-bit integers are detected in the */
  950. /* file `ftconfig.h' either statically or through the */
  951. /* `configure' script on supported platforms. */
  952. /* */
  953. #undef FT_CONFIG_OPTION_FORCE_INT64
  954. /*************************************************************************/
  955. /* */
  956. /* If this macro is defined, do not try to use an assembler version of */
  957. /* performance-critical functions (e.g. FT_MulFix). You should only do */
  958. /* that to verify that the assembler function works properly, or to */
  959. /* execute benchmark tests of the various implementations. */
  960. /* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
  961. /*************************************************************************/
  962. /* */
  963. /* If this macro is defined, try to use an inlined assembler version of */
  964. /* the `FT_MulFix' function, which is a `hotspot' when loading and */
  965. /* hinting glyphs, and which should be executed as fast as possible. */
  966. /* */
  967. /* Note that if your compiler or CPU is not supported, this will default */
  968. /* to the standard and portable implementation found in `ftcalc.c'. */
  969. /* */
  970. #define FT_CONFIG_OPTION_INLINE_MULFIX
  971. /*************************************************************************/
  972. /* */
  973. /* LZW-compressed file support. */
  974. /* */
  975. /* FreeType now handles font files that have been compressed with the */
  976. /* `compress' program. This is mostly used to parse many of the PCF */
  977. /* files that come with various X11 distributions. The implementation */
  978. /* uses NetBSD's `zopen' to partially uncompress the file on the fly */
  979. /* (see src/lzw/ftgzip.c). */
  980. /* */
  981. /* Define this macro if you want to enable this `feature'. */
  982. /* */
  983. #define FT_CONFIG_OPTION_USE_LZW
  984. /*************************************************************************/
  985. /* */
  986. /* Gzip-compressed file support. */
  987. /* */
  988. /* FreeType now handles font files that have been compressed with the */
  989. /* `gzip' program. This is mostly used to parse many of the PCF files */
  990. /* that come with XFree86. The implementation uses `zlib' to */
  991. /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */
  992. /* */
  993. /* Define this macro if you want to enable this `feature'. See also */
  994. /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
  995. /* */
  996. #define FT_CONFIG_OPTION_USE_ZLIB
  997. /*************************************************************************/
  998. /* */
  999. /* ZLib library selection */
  1000. /* */
  1001. /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */
  1002. /* It allows FreeType's `ftgzip' component to link to the system's */
  1003. /* installation of the ZLib library. This is useful on systems like */
  1004. /* Unix or VMS where it generally is already available. */
  1005. /* */
  1006. /* If you let it undefined, the component will use its own copy */
  1007. /* of the zlib sources instead. These have been modified to be */
  1008. /* included directly within the component and *not* export external */
  1009. /* function names. This allows you to link any program with FreeType */
  1010. /* _and_ ZLib without linking conflicts. */
  1011. /* */
  1012. /* Do not #undef this macro here since the build system might define */
  1013. /* it for certain configurations only. */
  1014. /* */
  1015. /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
  1016. /*************************************************************************/
  1017. /* */
  1018. /* Bzip2-compressed file support. */
  1019. /* */
  1020. /* FreeType now handles font files that have been compressed with the */
  1021. /* `bzip2' program. This is mostly used to parse many of the PCF */
  1022. /* files that come with XFree86. The implementation uses `libbz2' to */
  1023. /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */
  1024. /* Contrary to gzip, bzip2 currently is not included and need to use */
  1025. /* the system available bzip2 implementation. */
  1026. /* */
  1027. /* Define this macro if you want to enable this `feature'. */
  1028. /* */
  1029. /* #define FT_CONFIG_OPTION_USE_BZIP2 */
  1030. /*************************************************************************/
  1031. /* */
  1032. /* Define to disable the use of file stream functions and types, FILE, */
  1033. /* fopen() etc. Enables the use of smaller system libraries on embedded */
  1034. /* systems that have multiple system libraries, some with or without */
  1035. /* file stream support, in the cases where file stream support is not */
  1036. /* necessary such as memory loading of font files. */
  1037. /* */
  1038. /* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
  1039. /*************************************************************************/
  1040. /* */
  1041. /* DLL export compilation */
  1042. /* */
  1043. /* When compiling FreeType as a DLL, some systems/compilers need a */
  1044. /* special keyword in front OR after the return type of function */
  1045. /* declarations. */
  1046. /* */
  1047. /* Two macros are used within the FreeType source code to define */
  1048. /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
  1049. /* */
  1050. /* FT_EXPORT( return_type ) */
  1051. /* */
  1052. /* is used in a function declaration, as in */
  1053. /* */
  1054. /* FT_EXPORT( FT_Error ) */
  1055. /* FT_Init_FreeType( FT_Library* alibrary ); */
  1056. /* */
  1057. /* */
  1058. /* FT_EXPORT_DEF( return_type ) */
  1059. /* */
  1060. /* is used in a function definition, as in */
  1061. /* */
  1062. /* FT_EXPORT_DEF( FT_Error ) */
  1063. /* FT_Init_FreeType( FT_Library* alibrary ) */
  1064. /* { */
  1065. /* ... some code ... */
  1066. /* return FT_Err_Ok; */
  1067. /* } */
  1068. /* */
  1069. /* You can provide your own implementation of FT_EXPORT and */
  1070. /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
  1071. /* will be later automatically defined as `extern return_type' to */
  1072. /* allow normal compilation. */
  1073. /* */
  1074. /* Do not #undef these macros here since the build system might define */
  1075. /* them for certain configurations only. */
  1076. /* */
  1077. /* #define FT_EXPORT(x) extern x */
  1078. /* #define FT_EXPORT_DEF(x) x */
  1079. /*************************************************************************/
  1080. /* */
  1081. /* Glyph Postscript Names handling */
  1082. /* */
  1083. /* By default, FreeType 2 is compiled with the `psnames' module. This */
  1084. /* module is in charge of converting a glyph name string into a */
  1085. /* Unicode value, or return a Macintosh standard glyph name for the */
  1086. /* use with the TrueType `post' table. */
  1087. /* */
  1088. /* Undefine this macro if you do not want `psnames' compiled in your */
  1089. /* build of FreeType. This has the following effects: */
  1090. /* */
  1091. /* - The TrueType driver will provide its own set of glyph names, */
  1092. /* if you build it to support postscript names in the TrueType */
  1093. /* `post' table. */
  1094. /* */
  1095. /* - The Type 1 driver will not be able to synthesize a Unicode */
  1096. /* charmap out of the glyphs found in the fonts. */
  1097. /* */
  1098. /* You would normally undefine this configuration macro when building */
  1099. /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
  1100. /* */
  1101. #define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
  1102. /*************************************************************************/
  1103. /* */
  1104. /* Postscript Names to Unicode Values support */
  1105. /* */
  1106. /* By default, FreeType 2 is built with the `PSNames' module compiled */
  1107. /* in. Among other things, the module is used to convert a glyph name */
  1108. /* into a Unicode value. This is especially useful in order to */
  1109. /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */
  1110. /* through a big table named the `Adobe Glyph List' (AGL). */
  1111. /* */
  1112. /* Undefine this macro if you do not want the Adobe Glyph List */
  1113. /* compiled in your `PSNames' module. The Type 1 driver will not be */
  1114. /* able to synthesize a Unicode charmap out of the glyphs found in the */
  1115. /* fonts. */
  1116. /* */
  1117. #define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
  1118. /*************************************************************************/
  1119. /* */
  1120. /* Support for Mac fonts */
  1121. /* */
  1122. /* Define this macro if you want support for outline fonts in Mac */
  1123. /* format (mac dfont, mac resource, macbinary containing a mac */
  1124. /* resource) on non-Mac platforms. */
  1125. /* */
  1126. /* Note that the `FOND' resource isn't checked. */
  1127. /* */
  1128. #define FT_CONFIG_OPTION_MAC_FONTS
  1129. /*************************************************************************/
  1130. /* */
  1131. /* Guessing methods to access embedded resource forks */
  1132. /* */
  1133. /* Enable extra Mac fonts support on non-Mac platforms (e.g. */
  1134. /* GNU/Linux). */
  1135. /* */
  1136. /* Resource forks which include fonts data are stored sometimes in */
  1137. /* locations which users or developers don't expected. In some cases, */
  1138. /* resource forks start with some offset from the head of a file. In */
  1139. /* other cases, the actual resource fork is stored in file different */
  1140. /* from what the user specifies. If this option is activated, */
  1141. /* FreeType tries to guess whether such offsets or different file */
  1142. /* names must be used. */
  1143. /* */
  1144. /* Note that normal, direct access of resource forks is controlled via */
  1145. /* the FT_CONFIG_OPTION_MAC_FONTS option. */
  1146. /* */
  1147. #ifdef FT_CONFIG_OPTION_MAC_FONTS
  1148. #define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
  1149. #endif
  1150. /*************************************************************************/
  1151. /* */
  1152. /* Allow the use of FT_Incremental_Interface to load typefaces that */
  1153. /* contain no glyph data, but supply it via a callback function. */
  1154. /* This is required by clients supporting document formats which */
  1155. /* supply font data incrementally as the document is parsed, such */
  1156. /* as the Ghostscript interpreter for the PostScript language. */
  1157. /* */
  1158. #define FT_CONFIG_OPTION_INCREMENTAL
  1159. /*************************************************************************/
  1160. /* */
  1161. /* The size in bytes of the render pool used by the scan-line converter */
  1162. /* to do all of its work. */
  1163. /* */
  1164. /* This must be greater than 4KByte if you use FreeType to rasterize */
  1165. /* glyphs; otherwise, you may set it to zero to avoid unnecessary */
  1166. /* allocation of the render pool. */
  1167. /* */
  1168. #define FT_RENDER_POOL_SIZE 16384L
  1169. /*************************************************************************/
  1170. /* */
  1171. /* FT_MAX_MODULES */
  1172. /* */
  1173. /* The maximum number of modules that can be registered in a single */
  1174. /* FreeType library object. 32 is the default. */
  1175. /* */
  1176. #define FT_MAX_MODULES 32
  1177. /*************************************************************************/
  1178. /* */
  1179. /* Debug level */
  1180. /* */
  1181. /* FreeType can be compiled in debug or trace mode. In debug mode, */
  1182. /* errors are reported through the `ftdebug' component. In trace */
  1183. /* mode, additional messages are sent to the standard output during */
  1184. /* execution. */
  1185. /* */
  1186. /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
  1187. /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
  1188. /* */
  1189. /* Don't define any of these macros to compile in `release' mode! */
  1190. /* */
  1191. /* Do not #undef these macros here since the build system might define */
  1192. /* them for certain configurations only. */
  1193. /* */
  1194. /* #define FT_DEBUG_LEVEL_ERROR */
  1195. /* #define FT_DEBUG_LEVEL_TRACE */
  1196. /*************************************************************************/
  1197. /* */
  1198. /* Autofitter debugging */
  1199. /* */
  1200. /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */
  1201. /* control the autofitter behaviour for debugging purposes with global */
  1202. /* boolean variables (consequently, you should *never* enable this */
  1203. /* while compiling in `release' mode): */
  1204. /* */
  1205. /* _af_debug_disable_horz_hints */
  1206. /* _af_debug_disable_vert_hints */
  1207. /* _af_debug_disable_blue_hints */
  1208. /* */
  1209. /* Additionally, the following functions provide dumps of various */
  1210. /* internal autofit structures to stdout (using `printf'): */
  1211. /* */
  1212. /* af_glyph_hints_dump_points */
  1213. /* af_glyph_hints_dump_segments */
  1214. /* af_glyph_hints_dump_edges */
  1215. /* */
  1216. /* As an argument, they use another global variable: */
  1217. /* */
  1218. /* _af_debug_hints */
  1219. /* */
  1220. /* Please have a look at the `ftgrid' demo program to see how those */
  1221. /* variables and macros should be used. */
  1222. /* */
  1223. /* Do not #undef these macros here since the build system might define */
  1224. /* them for certain configurations only. */
  1225. /* */
  1226. /* #define FT_DEBUG_AUTOFIT */
  1227. /*************************************************************************/
  1228. /* */
  1229. /* Memory Debugging */
  1230. /* */
  1231. /* FreeType now comes with an integrated memory debugger that is */
  1232. /* capable of detecting simple errors like memory leaks or double */
  1233. /* deletes. To compile it within your build of the library, you */
  1234. /* should define FT_DEBUG_MEMORY here. */
  1235. /* */
  1236. /* Note that the memory debugger is only activated at runtime when */
  1237. /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */
  1238. /* */
  1239. /* Do not #undef this macro here since the build system might define */
  1240. /* it for certain configurations only. */
  1241. /* */
  1242. /* #define FT_DEBUG_MEMORY */
  1243. /*************************************************************************/
  1244. /* */
  1245. /* Module errors */
  1246. /* */
  1247. /* If this macro is set (which is _not_ the default), the higher byte */
  1248. /* of an error code gives the module in which the error has occurred, */
  1249. /* while the lower byte is the real error code. */
  1250. /* */
  1251. /* Setting this macro makes sense for debugging purposes only, since */
  1252. /* it would break source compatibility of certain programs that use */
  1253. /* FreeType 2. */
  1254. /* */
  1255. /* More details can be found in the files ftmoderr.h and fterrors.h. */
  1256. /* */
  1257. #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
  1258. /*************************************************************************/
  1259. /* */
  1260. /* Position Independent Code */
  1261. /* */
  1262. /* If this macro is set (which is _not_ the default), FreeType2 will */
  1263. /* avoid creating constants that require address fixups. Instead the */
  1264. /* constants will be moved into a struct and additional intialization */
  1265. /* code will be used. */
  1266. /* */
  1267. /* Setting this macro is needed for systems that prohibit address */
  1268. /* fixups, such as BREW. */
  1269. /* */
  1270. /* #define FT_CONFIG_OPTION_PIC */
  1271. /*************************************************************************/
  1272. /*************************************************************************/
  1273. /**** ****/
  1274. /**** S F N T D R I V E R C O N F I G U R A T I O N ****/
  1275. /**** ****/
  1276. /*************************************************************************/
  1277. /*************************************************************************/
  1278. /*************************************************************************/
  1279. /* */
  1280. /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
  1281. /* embedded bitmaps in all formats using the SFNT module (namely */
  1282. /* TrueType & OpenType). */
  1283. /* */
  1284. #define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
  1285. /*************************************************************************/
  1286. /* */
  1287. /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
  1288. /* load and enumerate the glyph Postscript names in a TrueType or */
  1289. /* OpenType file. */
  1290. /* */
  1291. /* Note that when you do not compile the `PSNames' module by undefining */
  1292. /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
  1293. /* contain additional code used to read the PS Names table from a font. */
  1294. /* */
  1295. /* (By default, the module uses `PSNames' to extract glyph names.) */
  1296. /* */
  1297. #define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
  1298. /*************************************************************************/
  1299. /* */
  1300. /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
  1301. /* access the internal name table in a SFNT-based format like TrueType */
  1302. /* or OpenType. The name table contains various strings used to */
  1303. /* describe the font, like family name, copyright, version, etc. It */
  1304. /* does not contain any glyph name though. */
  1305. /* */
  1306. /* Accessing SFNT names is done through the functions declared in */
  1307. /* `freetype/ftsnames.h'. */
  1308. /* */
  1309. #define TT_CONFIG_OPTION_SFNT_NAMES
  1310. /*************************************************************************/
  1311. /* */
  1312. /* TrueType CMap support */
  1313. /* */
  1314. /* Here you can fine-tune which TrueType CMap table format shall be */
  1315. /* supported. */
  1316. #define TT_CONFIG_CMAP_FORMAT_0
  1317. #define TT_CONFIG_CMAP_FORMAT_2
  1318. #define TT_CONFIG_CMAP_FORMAT_4
  1319. #define TT_CONFIG_CMAP_FORMAT_6
  1320. #define TT_CONFIG_CMAP_FORMAT_8
  1321. #define TT_CONFIG_CMAP_FORMAT_10
  1322. #define TT_CONFIG_CMAP_FORMAT_12
  1323. #define TT_CONFIG_CMAP_FORMAT_13
  1324. #define TT_CONFIG_CMAP_FORMAT_14
  1325. /*************************************************************************/
  1326. /*************************************************************************/
  1327. /**** ****/
  1328. /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
  1329. /**** ****/
  1330. /*************************************************************************/
  1331. /*************************************************************************/
  1332. /*************************************************************************/
  1333. /* */
  1334. /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
  1335. /* a bytecode interpreter in the TrueType driver. */
  1336. /* */
  1337. /* By undefining this, you will only compile the code necessary to load */
  1338. /* TrueType glyphs without hinting. */
  1339. /* */
  1340. /* Do not #undef this macro here, since the build system might */
  1341. /* define it for certain configurations only. */
  1342. /* */
  1343. #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
  1344. /*************************************************************************/
  1345. /* */
  1346. /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */
  1347. /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */
  1348. /* replaces the native TrueType hinting mechanism when anything but */
  1349. /* FT_RENDER_MODE_MONO is requested. */
  1350. /* */
  1351. /* Enabling this causes the TrueType driver to ignore instructions under */
  1352. /* certain conditions. This is done in accordance with the guide here, */
  1353. /* with some minor differences: */
  1354. /* */
  1355. /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
  1356. /* */
  1357. /* By undefining this, you only compile the code necessary to hint */
  1358. /* TrueType glyphs with native TT hinting. */
  1359. /* */
  1360. /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */
  1361. /* defined. */
  1362. /* */
  1363. /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */
  1364. /*************************************************************************/
  1365. /* */
  1366. /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */
  1367. /* of the TrueType bytecode interpreter is used that doesn't implement */
  1368. /* any of the patented opcodes and algorithms. The patents related to */
  1369. /* TrueType hinting have expired worldwide since May 2010; this option */
  1370. /* is now deprecated. */
  1371. /* */
  1372. /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */
  1373. /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */
  1374. /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */
  1375. /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */
  1376. /* */
  1377. /* This macro is only useful for a small number of font files (mostly */
  1378. /* for Asian scripts) that require bytecode interpretation to properly */
  1379. /* load glyphs. For all other fonts, this produces unpleasant results, */
  1380. /* thus the unpatented interpreter is never used to load glyphs from */
  1381. /* TrueType fonts unless one of the following two options is used. */
  1382. /* */
  1383. /* - The unpatented interpreter is explicitly activated by the user */
  1384. /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */
  1385. /* when opening the FT_Face. */
  1386. /* */
  1387. /* - FreeType detects that the FT_Face corresponds to one of the */
  1388. /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */
  1389. /* contains a hard-coded list of font names and other matching */
  1390. /* parameters (see function `tt_face_init' in file */
  1391. /* `src/truetype/ttobjs.c'). */
  1392. /* */
  1393. /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */
  1394. /* */
  1395. /* { */
  1396. /* FT_Parameter parameter; */
  1397. /* FT_Open_Args open_args; */
  1398. /* */
  1399. /* */
  1400. /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */
  1401. /* */
  1402. /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */
  1403. /* open_args.pathname = my_font_pathname; */
  1404. /* open_args.num_params = 1; */
  1405. /* open_args.params = &parameter; */
  1406. /* */
  1407. /* error = FT_Open_Face( library, &open_args, index, &face ); */
  1408. /* ... */
  1409. /* } */
  1410. /* */
  1411. /* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */
  1412. /*************************************************************************/
  1413. /* */
  1414. /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */
  1415. /* bytecode interpreter with a huge switch statement, rather than a call */
  1416. /* table. This results in smaller and faster code for a number of */
  1417. /* architectures. */
  1418. /* */
  1419. /* Note however that on some compiler/processor combinations, undefining */
  1420. /* this macro will generate faster, though larger, code. */
  1421. /* */
  1422. #define TT_CONFIG_OPTION_INTERPRETER_SWITCH
  1423. /*************************************************************************/
  1424. /* */
  1425. /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */
  1426. /* TrueType glyph loader to use Apple's definition of how to handle */
  1427. /* component offsets in composite glyphs. */
  1428. /* */
  1429. /* Apple and MS disagree on the default behavior of component offsets */
  1430. /* in composites. Apple says that they should be scaled by the scaling */
  1431. /* factors in the transformation matrix (roughly, it's more complex) */
  1432. /* while MS says they should not. OpenType defines two bits in the */
  1433. /* composite flags array which can be used to disambiguate, but old */
  1434. /* fonts will not have them. */
  1435. /* */
  1436. /* http://www.microsoft.com/typography/otspec/glyf.htm */
  1437. /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */
  1438. /* */
  1439. #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
  1440. /*************************************************************************/
  1441. /* */
  1442. /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */
  1443. /* support for Apple's distortable font technology (fvar, gvar, cvar, */
  1444. /* and avar tables). This has many similarities to Type 1 Multiple */
  1445. /* Masters support. */
  1446. /* */
  1447. #define TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1448. /*************************************************************************/
  1449. /* */
  1450. /* Define TT_CONFIG_OPTION_BDF if you want to include support for */
  1451. /* an embedded `BDF ' table within SFNT-based bitmap formats. */
  1452. /* */
  1453. #define TT_CONFIG_OPTION_BDF
  1454. /*************************************************************************/
  1455. /*************************************************************************/
  1456. /**** ****/
  1457. /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
  1458. /**** ****/
  1459. /*************************************************************************/
  1460. /*************************************************************************/
  1461. /*************************************************************************/
  1462. /* */
  1463. /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */
  1464. /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
  1465. /* required. */
  1466. /* */
  1467. #define T1_MAX_DICT_DEPTH 5
  1468. /*************************************************************************/
  1469. /* */
  1470. /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
  1471. /* calls during glyph loading. */
  1472. /* */
  1473. #define T1_MAX_SUBRS_CALLS 16
  1474. /*************************************************************************/
  1475. /* */
  1476. /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
  1477. /* minimum of 16 is required. */
  1478. /* */
  1479. /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
  1480. /* */
  1481. #define T1_MAX_CHARSTRINGS_OPERANDS 256
  1482. /*************************************************************************/
  1483. /* */
  1484. /* Define this configuration macro if you want to prevent the */
  1485. /* compilation of `t1afm', which is in charge of reading Type 1 AFM */
  1486. /* files into an existing face. Note that if set, the T1 driver will be */
  1487. /* unable to produce kerning distances. */
  1488. /* */
  1489. #undef T1_CONFIG_OPTION_NO_AFM
  1490. /*************************************************************************/
  1491. /* */
  1492. /* Define this configuration macro if you want to prevent the */
  1493. /* compilation of the Multiple Masters font support in the Type 1 */
  1494. /* driver. */
  1495. /* */
  1496. #undef T1_CONFIG_OPTION_NO_MM_SUPPORT
  1497. /*************************************************************************/
  1498. /*************************************************************************/
  1499. /**** ****/
  1500. /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
  1501. /**** ****/
  1502. /*************************************************************************/
  1503. /*************************************************************************/
  1504. /*************************************************************************/
  1505. /* */
  1506. /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */
  1507. /* support. */
  1508. /* */
  1509. #define AF_CONFIG_OPTION_CJK
  1510. /*************************************************************************/
  1511. /* */
  1512. /* Compile autofit module with Indic script support. */
  1513. /* */
  1514. #define AF_CONFIG_OPTION_INDIC
  1515. /*************************************************************************/
  1516. /* */
  1517. /* Compile autofit module with warp hinting. The idea of the warping */
  1518. /* code is to slightly scale and shift a glyph within a single dimension */
  1519. /* so that as much of its segments are aligned (more or less) on the */
  1520. /* grid. To find out the optimal scaling and shifting value, various */
  1521. /* parameter combinations are tried and scored. */
  1522. /* */
  1523. /* This experimental option is only active if the render mode is */
  1524. /* FT_RENDER_MODE_LIGHT. */
  1525. /* */
  1526. /* #define AF_CONFIG_OPTION_USE_WARPER */
  1527. /* */
  1528. /*
  1529. * This macro is obsolete. Support has been removed in FreeType
  1530. * version 2.5.
  1531. */
  1532. /* #define FT_CONFIG_OPTION_OLD_INTERNALS */
  1533. /*
  1534. * This macro is defined if either unpatented or native TrueType
  1535. * hinting is requested by the definitions above.
  1536. */
  1537. #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
  1538. #define TT_USE_BYTECODE_INTERPRETER
  1539. #undef TT_CONFIG_OPTION_UNPATENTED_HINTING
  1540. #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
  1541. #define TT_USE_BYTECODE_INTERPRETER
  1542. #endif
  1543. FT_END_HEADER
  1544. #endif /* __FTOPTION_H__ */
  1545. /* END */
  1546. /*** End of inlined file: ftoption.h ***/
  1547. /*** Start of inlined file: ftstdlib.h ***/
  1548. /* */
  1549. /* ftstdlib.h */
  1550. /* */
  1551. /* ANSI-specific library and header configuration file (specification */
  1552. /* only). */
  1553. /* */
  1554. /* Copyright 2002-2007, 2009, 2011-2012 by */
  1555. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  1556. /* */
  1557. /* This file is part of the FreeType project, and may only be used, */
  1558. /* modified, and distributed under the terms of the FreeType project */
  1559. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  1560. /* this file you indicate that you have read the license and */
  1561. /* understand and accept it fully. */
  1562. /* */
  1563. /***************************************************************************/
  1564. /*************************************************************************/
  1565. /* */
  1566. /* This file is used to group all #includes to the ANSI C library that */
  1567. /* FreeType normally requires. It also defines macros to rename the */
  1568. /* standard functions within the FreeType source code. */
  1569. /* */
  1570. /* Load a file which defines __FTSTDLIB_H__ before this one to override */
  1571. /* it. */
  1572. /* */
  1573. /*************************************************************************/
  1574. #ifndef __FTSTDLIB_H__
  1575. #define __FTSTDLIB_H__
  1576. #include <stddef.h>
  1577. #define ft_ptrdiff_t ptrdiff_t
  1578. /**********************************************************************/
  1579. /* */
  1580. /* integer limits */
  1581. /* */
  1582. /* UINT_MAX and ULONG_MAX are used to automatically compute the size */
  1583. /* of `int' and `long' in bytes at compile-time. So far, this works */
  1584. /* for all platforms the library has been tested on. */
  1585. /* */
  1586. /* Note that on the extremely rare platforms that do not provide */
  1587. /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */
  1588. /* old Crays where `int' is 36 bits), we do not make any guarantee */
  1589. /* about the correct behaviour of FT2 with all fonts. */
  1590. /* */
  1591. /* In these case, `ftconfig.h' will refuse to compile anyway with a */
  1592. /* message like `couldn't find 32-bit type' or something similar. */
  1593. /* */
  1594. /**********************************************************************/
  1595. #include <limits.h>
  1596. #define FT_CHAR_BIT CHAR_BIT
  1597. #define FT_USHORT_MAX USHRT_MAX
  1598. #define FT_INT_MAX INT_MAX
  1599. #define FT_INT_MIN INT_MIN
  1600. #define FT_UINT_MAX UINT_MAX
  1601. #define FT_ULONG_MAX ULONG_MAX
  1602. /**********************************************************************/
  1603. /* */
  1604. /* character and string processing */
  1605. /* */
  1606. /**********************************************************************/
  1607. #include <string.h>
  1608. #define ft_memchr memchr
  1609. #define ft_memcmp memcmp
  1610. #define ft_memcpy memcpy
  1611. #define ft_memmove memmove
  1612. #define ft_memset memset
  1613. #define ft_strcat strcat
  1614. #define ft_strcmp strcmp
  1615. #define ft_strcpy strcpy
  1616. #define ft_strlen strlen
  1617. #define ft_strncmp strncmp
  1618. #define ft_strncpy strncpy
  1619. #define ft_strrchr strrchr
  1620. #define ft_strstr strstr
  1621. /**********************************************************************/
  1622. /* */
  1623. /* file handling */
  1624. /* */
  1625. /**********************************************************************/
  1626. #include <stdio.h>
  1627. #define FT_FILE FILE
  1628. #define ft_fclose fclose
  1629. #define ft_fopen fopen
  1630. #define ft_fread fread
  1631. #define ft_fseek fseek
  1632. #define ft_ftell ftell
  1633. #define ft_sprintf sprintf
  1634. /**********************************************************************/
  1635. /* */
  1636. /* sorting */
  1637. /* */
  1638. /**********************************************************************/
  1639. #include <stdlib.h>
  1640. #define ft_qsort qsort
  1641. /**********************************************************************/
  1642. /* */
  1643. /* memory allocation */
  1644. /* */
  1645. /**********************************************************************/
  1646. #define ft_scalloc calloc
  1647. #define ft_sfree free
  1648. #define ft_smalloc malloc
  1649. #define ft_srealloc realloc
  1650. /**********************************************************************/
  1651. /* */
  1652. /* miscellaneous */
  1653. /* */
  1654. /**********************************************************************/
  1655. #define ft_atol atol
  1656. #define ft_labs labs
  1657. /**********************************************************************/
  1658. /* */
  1659. /* execution control */
  1660. /* */
  1661. /**********************************************************************/
  1662. #include <setjmp.h>
  1663. #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
  1664. /* jmp_buf is defined as a macro */
  1665. /* on certain platforms */
  1666. #define ft_longjmp longjmp
  1667. #define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
  1668. /* the following is only used for debugging purposes, i.e., if */
  1669. /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
  1670. #include <stdarg.h>
  1671. #endif /* __FTSTDLIB_H__ */
  1672. /* END */
  1673. /*** End of inlined file: ftstdlib.h ***/
  1674. FT_BEGIN_HEADER
  1675. /*************************************************************************/
  1676. /* */
  1677. /* PLATFORM-SPECIFIC CONFIGURATION MACROS */
  1678. /* */
  1679. /* These macros can be toggled to suit a specific system. The current */
  1680. /* ones are defaults used to compile FreeType in an ANSI C environment */
  1681. /* (16bit compilers are also supported). Copy this file to your own */
  1682. /* `freetype/builds/<system>' directory, and edit it to port the engine. */
  1683. /* */
  1684. /*************************************************************************/
  1685. /* There are systems (like the Texas Instruments 'C54x) where a `char' */
  1686. /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
  1687. /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
  1688. /* is probably unexpected. */
  1689. /* */
  1690. /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
  1691. /* `char' type. */
  1692. #ifndef FT_CHAR_BIT
  1693. #define FT_CHAR_BIT CHAR_BIT
  1694. #endif
  1695. /* The size of an `int' type. */
  1696. #if FT_UINT_MAX == 0xFFFFUL
  1697. #define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
  1698. #elif FT_UINT_MAX == 0xFFFFFFFFUL
  1699. #define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
  1700. #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
  1701. #define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
  1702. #else
  1703. #error "Unsupported size of `int' type!"
  1704. #endif
  1705. /* The size of a `long' type. A five-byte `long' (as used e.g. on the */
  1706. /* DM642) is recognized but avoided. */
  1707. #if FT_ULONG_MAX == 0xFFFFFFFFUL
  1708. #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
  1709. #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
  1710. #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
  1711. #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
  1712. #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
  1713. #else
  1714. #error "Unsupported size of `long' type!"
  1715. #endif
  1716. /* FT_UNUSED is a macro used to indicate that a given parameter is not */
  1717. /* used -- this is only used to get rid of unpleasant compiler warnings */
  1718. #ifndef FT_UNUSED
  1719. #define FT_UNUSED( arg ) ( (arg) = (arg) )
  1720. #endif
  1721. /*************************************************************************/
  1722. /* */
  1723. /* AUTOMATIC CONFIGURATION MACROS */
  1724. /* */
  1725. /* These macros are computed from the ones defined above. Don't touch */
  1726. /* their definition, unless you know precisely what you are doing. No */
  1727. /* porter should need to mess with them. */
  1728. /* */
  1729. /*************************************************************************/
  1730. /*************************************************************************/
  1731. /* */
  1732. /* Mac support */
  1733. /* */
  1734. /* This is the only necessary change, so it is defined here instead */
  1735. /* providing a new configuration file. */
  1736. /* */
  1737. #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
  1738. /* no Carbon frameworks for 64bit 10.4.x */
  1739. /* AvailabilityMacros.h is available since Mac OS X 10.2, */
  1740. /* so guess the system version by maximum errno before inclusion */
  1741. #include <errno.h>
  1742. #ifdef ECANCELED /* defined since 10.2 */
  1743. #include "AvailabilityMacros.h"
  1744. #endif
  1745. #if defined( __LP64__ ) && \
  1746. ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
  1747. #undef FT_MACINTOSH
  1748. #endif
  1749. #elif defined( __SC__ ) || defined( __MRC__ )
  1750. /* Classic MacOS compilers */
  1751. #include "ConditionalMacros.h"
  1752. #if TARGET_OS_MAC
  1753. #define FT_MACINTOSH 1
  1754. #endif
  1755. #endif
  1756. /*************************************************************************/
  1757. /* */
  1758. /* <Section> */
  1759. /* basic_types */
  1760. /* */
  1761. /*************************************************************************/
  1762. /*************************************************************************/
  1763. /* */
  1764. /* <Type> */
  1765. /* FT_Int16 */
  1766. /* */
  1767. /* <Description> */
  1768. /* A typedef for a 16bit signed integer type. */
  1769. /* */
  1770. typedef signed short FT_Int16;
  1771. /*************************************************************************/
  1772. /* */
  1773. /* <Type> */
  1774. /* FT_UInt16 */
  1775. /* */
  1776. /* <Description> */
  1777. /* A typedef for a 16bit unsigned integer type. */
  1778. /* */
  1779. typedef unsigned short FT_UInt16;
  1780. /* */
  1781. /* this #if 0 ... #endif clause is for documentation purposes */
  1782. #if 0
  1783. /*************************************************************************/
  1784. /* */
  1785. /* <Type> */
  1786. /* FT_Int32 */
  1787. /* */
  1788. /* <Description> */
  1789. /* A typedef for a 32bit signed integer type. The size depends on */
  1790. /* the configuration. */
  1791. /* */
  1792. typedef signed XXX FT_Int32;
  1793. /*************************************************************************/
  1794. /* */
  1795. /* <Type> */
  1796. /* FT_UInt32 */
  1797. /* */
  1798. /* A typedef for a 32bit unsigned integer type. The size depends on */
  1799. /* the configuration. */
  1800. /* */
  1801. typedef unsigned XXX FT_UInt32;
  1802. /*************************************************************************/
  1803. /* */
  1804. /* <Type> */
  1805. /* FT_Int64 */
  1806. /* */
  1807. /* A typedef for a 64bit signed integer type. The size depends on */
  1808. /* the configuration. Only defined if there is real 64bit support; */
  1809. /* otherwise, it gets emulated with a structure (if necessary). */
  1810. /* */
  1811. typedef signed XXX FT_Int64;
  1812. /*************************************************************************/
  1813. /* */
  1814. /* <Type> */
  1815. /* FT_UInt64 */
  1816. /* */
  1817. /* A typedef for a 64bit unsigned integer type. The size depends on */
  1818. /* the configuration. Only defined if there is real 64bit support; */
  1819. /* otherwise, it gets emulated with a structure (if necessary). */
  1820. /* */
  1821. typedef unsigned XXX FT_UInt64;
  1822. /* */
  1823. #endif
  1824. #if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
  1825. typedef signed int FT_Int32;
  1826. typedef unsigned int FT_UInt32;
  1827. #elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
  1828. typedef signed long FT_Int32;
  1829. typedef unsigned long FT_UInt32;
  1830. #else
  1831. #error "no 32bit type found -- please check your configuration files"
  1832. #endif
  1833. /* look up an integer type that is at least 32 bits */
  1834. #if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
  1835. typedef int FT_Fast;
  1836. typedef unsigned int FT_UFast;
  1837. #elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
  1838. typedef long FT_Fast;
  1839. typedef unsigned long FT_UFast;
  1840. #endif
  1841. /* determine whether we have a 64-bit int type for platforms without */
  1842. /* Autoconf */
  1843. #if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
  1844. /* FT_LONG64 must be defined if a 64-bit type is available */
  1845. #define FT_LONG64
  1846. #define FT_INT64 long
  1847. #define FT_UINT64 unsigned long
  1848. #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
  1849. /* this compiler provides the __int64 type */
  1850. #define FT_LONG64
  1851. #define FT_INT64 __int64
  1852. #define FT_UINT64 unsigned __int64
  1853. #elif defined( __BORLANDC__ ) /* Borland C++ */
  1854. /* XXXX: We should probably check the value of __BORLANDC__ in order */
  1855. /* to test the compiler version. */
  1856. /* this compiler provides the __int64 type */
  1857. #define FT_LONG64
  1858. #define FT_INT64 __int64
  1859. #define FT_UINT64 unsigned __int64
  1860. #elif defined( __WATCOMC__ ) /* Watcom C++ */
  1861. /* Watcom doesn't provide 64-bit data types */
  1862. #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
  1863. #define FT_LONG64
  1864. #define FT_INT64 long long int
  1865. #define FT_UINT64 unsigned long long int
  1866. #elif defined( __GNUC__ )
  1867. /* GCC provides the `long long' type */
  1868. #define FT_LONG64
  1869. #define FT_INT64 long long int
  1870. #define FT_UINT64 unsigned long long int
  1871. #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
  1872. /*************************************************************************/
  1873. /* */
  1874. /* A 64-bit data type will create compilation problems if you compile */
  1875. /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
  1876. /* is defined. You can however ignore this rule by defining the */
  1877. /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
  1878. /* */
  1879. #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
  1880. #ifdef __STDC__
  1881. /* undefine the 64-bit macros in strict ANSI compilation mode */
  1882. #undef FT_LONG64
  1883. #undef FT_INT64
  1884. #endif /* __STDC__ */
  1885. #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
  1886. #ifdef FT_LONG64
  1887. typedef FT_INT64 FT_Int64;
  1888. typedef FT_UINT64 FT_UInt64;
  1889. #endif
  1890. #define FT_BEGIN_STMNT do {
  1891. #define FT_END_STMNT } while ( 0 )
  1892. #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
  1893. #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
  1894. /* Provide assembler fragments for performance-critical functions. */
  1895. /* These must be defined `static __inline__' with GCC. */
  1896. #if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */
  1897. #define FT_MULFIX_ASSEMBLER FT_MulFix_arm
  1898. /* documentation is in freetype.h */
  1899. static __inline FT_Int32
  1900. FT_MulFix_arm( FT_Int32 a,
  1901. FT_Int32 b )
  1902. {
  1903. register FT_Int32 t, t2;
  1904. __asm
  1905. {
  1906. smull t2, t, b, a /* (lo=t2,hi=t) = a*b */
  1907. mov a, t, asr #31 /* a = (hi >> 31) */
  1908. add a, a, #0x8000 /* a += 0x8000 */
  1909. adds t2, t2, a /* t2 += a */
  1910. adc t, t, #0 /* t += carry */
  1911. mov a, t2, lsr #16 /* a = t2 >> 16 */
  1912. orr a, a, t, lsl #16 /* a |= t << 16 */
  1913. }
  1914. return a;
  1915. }
  1916. #endif /* __CC_ARM || __ARMCC__ */
  1917. #ifdef __GNUC__
  1918. #if defined( __arm__ ) && !defined( __thumb__ ) && \
  1919. !( defined( __CC_ARM ) || defined( __ARMCC__ ) )
  1920. #define FT_MULFIX_ASSEMBLER FT_MulFix_arm
  1921. /* documentation is in freetype.h */
  1922. static __inline__ FT_Int32
  1923. FT_MulFix_arm( FT_Int32 a,
  1924. FT_Int32 b )
  1925. {
  1926. register FT_Int32 t, t2;
  1927. __asm__ __volatile__ (
  1928. "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
  1929. "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
  1930. "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
  1931. "adds %1, %1, %0\n\t" /* %1 += %0 */
  1932. "adc %2, %2, #0\n\t" /* %2 += carry */
  1933. "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
  1934. "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
  1935. : "=r"(a), "=&r"(t2), "=&r"(t)
  1936. : "r"(a), "r"(b)
  1937. : "cc" );
  1938. return a;
  1939. }
  1940. #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
  1941. #if defined( __i386__ )
  1942. #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
  1943. /* documentation is in freetype.h */
  1944. static __inline__ FT_Int32
  1945. FT_MulFix_i386( FT_Int32 a,
  1946. FT_Int32 b )
  1947. {
  1948. register FT_Int32 result;
  1949. __asm__ __volatile__ (
  1950. "imul %%edx\n"
  1951. "movl %%edx, %%ecx\n"
  1952. "sarl $31, %%ecx\n"
  1953. "addl $0x8000, %%ecx\n"
  1954. "addl %%ecx, %%eax\n"
  1955. "adcl $0, %%edx\n"
  1956. "shrl $16, %%eax\n"
  1957. "shll $16, %%edx\n"
  1958. "addl %%edx, %%eax\n"
  1959. : "=a"(result), "=d"(b)
  1960. : "a"(a), "d"(b)
  1961. : "%ecx", "cc" );
  1962. return result;
  1963. }
  1964. #endif /* i386 */
  1965. #endif /* __GNUC__ */
  1966. #ifdef _MSC_VER /* Visual C++ */
  1967. #ifdef _M_IX86
  1968. #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
  1969. /* documentation is in freetype.h */
  1970. static __inline FT_Int32
  1971. FT_MulFix_i386( FT_Int32 a,
  1972. FT_Int32 b )
  1973. {
  1974. register FT_Int32 result;
  1975. __asm
  1976. {
  1977. mov eax, a
  1978. mov edx, b
  1979. imul edx
  1980. mov ecx, edx
  1981. sar ecx, 31
  1982. add ecx, 8000h
  1983. add eax, ecx
  1984. adc edx, 0
  1985. shr eax, 16
  1986. shl edx, 16
  1987. add eax, edx
  1988. mov result, eax
  1989. }
  1990. return result;
  1991. }
  1992. #endif /* _M_IX86 */
  1993. #endif /* _MSC_VER */
  1994. #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
  1995. #ifdef FT_CONFIG_OPTION_INLINE_MULFIX
  1996. #ifdef FT_MULFIX_ASSEMBLER
  1997. #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
  1998. #endif
  1999. #endif
  2000. #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
  2001. #define FT_LOCAL( x ) static x
  2002. #define FT_LOCAL_DEF( x ) static x
  2003. #else
  2004. #ifdef __cplusplus
  2005. #define FT_LOCAL( x ) extern "C" x
  2006. #define FT_LOCAL_DEF( x ) extern "C" x
  2007. #else
  2008. #define FT_LOCAL( x ) extern x
  2009. #define FT_LOCAL_DEF( x ) x
  2010. #endif
  2011. #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
  2012. #ifndef FT_BASE
  2013. #ifdef __cplusplus
  2014. #define FT_BASE( x ) extern "C" x
  2015. #else
  2016. #define FT_BASE( x ) extern x
  2017. #endif
  2018. #endif /* !FT_BASE */
  2019. #ifndef FT_BASE_DEF
  2020. #ifdef __cplusplus
  2021. #define FT_BASE_DEF( x ) x
  2022. #else
  2023. #define FT_BASE_DEF( x ) x
  2024. #endif
  2025. #endif /* !FT_BASE_DEF */
  2026. #ifndef FT_EXPORT
  2027. #ifdef __cplusplus
  2028. #define FT_EXPORT( x ) extern "C" x
  2029. #else
  2030. #define FT_EXPORT( x ) extern x
  2031. #endif
  2032. #endif /* !FT_EXPORT */
  2033. #ifndef FT_EXPORT_DEF
  2034. #ifdef __cplusplus
  2035. #define FT_EXPORT_DEF( x ) extern "C" x
  2036. #else
  2037. #define FT_EXPORT_DEF( x ) extern x
  2038. #endif
  2039. #endif /* !FT_EXPORT_DEF */
  2040. #ifndef FT_EXPORT_VAR
  2041. #ifdef __cplusplus
  2042. #define FT_EXPORT_VAR( x ) extern "C" x
  2043. #else
  2044. #define FT_EXPORT_VAR( x ) extern x
  2045. #endif
  2046. #endif /* !FT_EXPORT_VAR */
  2047. /* The following macros are needed to compile the library with a */
  2048. /* C++ compiler and with 16bit compilers. */
  2049. /* */
  2050. /* This is special. Within C++, you must specify `extern "C"' for */
  2051. /* functions which are used via function pointers, and you also */
  2052. /* must do that for structures which contain function pointers to */
  2053. /* assure C linkage -- it's not possible to have (local) anonymous */
  2054. /* functions which are accessed by (global) function pointers. */
  2055. /* */
  2056. /* */
  2057. /* FT_CALLBACK_DEF is used to _define_ a callback function. */
  2058. /* */
  2059. /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
  2060. /* contains pointers to callback functions. */
  2061. /* */
  2062. /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
  2063. /* that contains pointers to callback functions. */
  2064. /* */
  2065. /* */
  2066. /* Some 16bit compilers have to redefine these macros to insert */
  2067. /* the infamous `_cdecl' or `__fastcall' declarations. */
  2068. /* */
  2069. #ifndef FT_CALLBACK_DEF
  2070. #ifdef __cplusplus
  2071. #define FT_CALLBACK_DEF( x ) extern "C" x
  2072. #else
  2073. #define FT_CALLBACK_DEF( x ) static x
  2074. #endif
  2075. #endif /* FT_CALLBACK_DEF */
  2076. #ifndef FT_CALLBACK_TABLE
  2077. #ifdef __cplusplus
  2078. #define FT_CALLBACK_TABLE extern "C"
  2079. #define FT_CALLBACK_TABLE_DEF extern "C"
  2080. #else
  2081. #define FT_CALLBACK_TABLE extern
  2082. #define FT_CALLBACK_TABLE_DEF /* nothing */
  2083. #endif
  2084. #endif /* FT_CALLBACK_TABLE */
  2085. FT_END_HEADER
  2086. #endif /* __FTCONFIG_H__ */
  2087. /* END */
  2088. /*** End of inlined file: ftconfig.h ***/
  2089. /*** Start of inlined file: fttypes.h ***/
  2090. /* */
  2091. /* fttypes.h */
  2092. /* */
  2093. /* FreeType simple types definitions (specification only). */
  2094. /* */
  2095. /* Copyright 1996-2002, 2004, 2006-2009, 2012, 2013 by */
  2096. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  2097. /* */
  2098. /* This file is part of the FreeType project, and may only be used, */
  2099. /* modified, and distributed under the terms of the FreeType project */
  2100. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  2101. /* this file you indicate that you have read the license and */
  2102. /* understand and accept it fully. */
  2103. /* */
  2104. /***************************************************************************/
  2105. #ifndef __FTTYPES_H__
  2106. #define __FTTYPES_H__
  2107. /*** Start of inlined file: ftsystem.h ***/
  2108. /* */
  2109. /* ftsystem.h */
  2110. /* */
  2111. /* FreeType low-level system interface definition (specification). */
  2112. /* */
  2113. /* Copyright 1996-2001, 2002, 2005, 2010 by */
  2114. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  2115. /* */
  2116. /* This file is part of the FreeType project, and may only be used, */
  2117. /* modified, and distributed under the terms of the FreeType project */
  2118. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  2119. /* this file you indicate that you have read the license and */
  2120. /* understand and accept it fully. */
  2121. /* */
  2122. /***************************************************************************/
  2123. #ifndef __FTSYSTEM_H__
  2124. #define __FTSYSTEM_H__
  2125. FT_BEGIN_HEADER
  2126. /*************************************************************************/
  2127. /* */
  2128. /* <Section> */
  2129. /* system_interface */
  2130. /* */
  2131. /* <Title> */
  2132. /* System Interface */
  2133. /* */
  2134. /* <Abstract> */
  2135. /* How FreeType manages memory and i/o. */
  2136. /* */
  2137. /* <Description> */
  2138. /* This section contains various definitions related to memory */
  2139. /* management and i/o access. You need to understand this */
  2140. /* information if you want to use a custom memory manager or you own */
  2141. /* i/o streams. */
  2142. /* */
  2143. /*************************************************************************/
  2144. /*************************************************************************/
  2145. /* */
  2146. /* M E M O R Y M A N A G E M E N T */
  2147. /* */
  2148. /*************************************************************************/
  2149. /*************************************************************************
  2150. *
  2151. * @type:
  2152. * FT_Memory
  2153. *
  2154. * @description:
  2155. * A handle to a given memory manager object, defined with an
  2156. * @FT_MemoryRec structure.
  2157. *
  2158. */
  2159. typedef struct FT_MemoryRec_* FT_Memory;
  2160. /*************************************************************************
  2161. *
  2162. * @functype:
  2163. * FT_Alloc_Func
  2164. *
  2165. * @description:
  2166. * A function used to allocate `size' bytes from `memory'.
  2167. *
  2168. * @input:
  2169. * memory ::
  2170. * A handle to the source memory manager.
  2171. *
  2172. * size ::
  2173. * The size in bytes to allocate.
  2174. *
  2175. * @return:
  2176. * Address of new memory block. 0~in case of failure.
  2177. *
  2178. */
  2179. typedef void*
  2180. (*FT_Alloc_Func)( FT_Memory memory,
  2181. long size );
  2182. /*************************************************************************
  2183. *
  2184. * @functype:
  2185. * FT_Free_Func
  2186. *
  2187. * @description:
  2188. * A function used to release a given block of memory.
  2189. *
  2190. * @input:
  2191. * memory ::
  2192. * A handle to the source memory manager.
  2193. *
  2194. * block ::
  2195. * The address of the target memory block.
  2196. *
  2197. */
  2198. typedef void
  2199. (*FT_Free_Func)( FT_Memory memory,
  2200. void* block );
  2201. /*************************************************************************
  2202. *
  2203. * @functype:
  2204. * FT_Realloc_Func
  2205. *
  2206. * @description:
  2207. * A function used to re-allocate a given block of memory.
  2208. *
  2209. * @input:
  2210. * memory ::
  2211. * A handle to the source memory manager.
  2212. *
  2213. * cur_size ::
  2214. * The block's current size in bytes.
  2215. *
  2216. * new_size ::
  2217. * The block's requested new size.
  2218. *
  2219. * block ::
  2220. * The block's current address.
  2221. *
  2222. * @return:
  2223. * New block address. 0~in case of memory shortage.
  2224. *
  2225. * @note:
  2226. * In case of error, the old block must still be available.
  2227. *
  2228. */
  2229. typedef void*
  2230. (*FT_Realloc_Func)( FT_Memory memory,
  2231. long cur_size,
  2232. long new_size,
  2233. void* block );
  2234. /*************************************************************************
  2235. *
  2236. * @struct:
  2237. * FT_MemoryRec
  2238. *
  2239. * @description:
  2240. * A structure used to describe a given memory manager to FreeType~2.
  2241. *
  2242. * @fields:
  2243. * user ::
  2244. * A generic typeless pointer for user data.
  2245. *
  2246. * alloc ::
  2247. * A pointer type to an allocation function.
  2248. *
  2249. * free ::
  2250. * A pointer type to an memory freeing function.
  2251. *
  2252. * realloc ::
  2253. * A pointer type to a reallocation function.
  2254. *
  2255. */
  2256. struct FT_MemoryRec_
  2257. {
  2258. void* user;
  2259. FT_Alloc_Func alloc;
  2260. FT_Free_Func free;
  2261. FT_Realloc_Func realloc;
  2262. };
  2263. /*************************************************************************/
  2264. /* */
  2265. /* I / O M A N A G E M E N T */
  2266. /* */
  2267. /*************************************************************************/
  2268. /*************************************************************************
  2269. *
  2270. * @type:
  2271. * FT_Stream
  2272. *
  2273. * @description:
  2274. * A handle to an input stream.
  2275. *
  2276. */
  2277. typedef struct FT_StreamRec_* FT_Stream;
  2278. /*************************************************************************
  2279. *
  2280. * @struct:
  2281. * FT_StreamDesc
  2282. *
  2283. * @description:
  2284. * A union type used to store either a long or a pointer. This is used
  2285. * to store a file descriptor or a `FILE*' in an input stream.
  2286. *
  2287. */
  2288. typedef union FT_StreamDesc_
  2289. {
  2290. long value;
  2291. void* pointer;
  2292. } FT_StreamDesc;
  2293. /*************************************************************************
  2294. *
  2295. * @functype:
  2296. * FT_Stream_IoFunc
  2297. *
  2298. * @description:
  2299. * A function used to seek and read data from a given input stream.
  2300. *
  2301. * @input:
  2302. * stream ::
  2303. * A handle to the source stream.
  2304. *
  2305. * offset ::
  2306. * The offset of read in stream (always from start).
  2307. *
  2308. * buffer ::
  2309. * The address of the read buffer.
  2310. *
  2311. * count ::
  2312. * The number of bytes to read from the stream.
  2313. *
  2314. * @return:
  2315. * The number of bytes effectively read by the stream.
  2316. *
  2317. * @note:
  2318. * This function might be called to perform a seek or skip operation
  2319. * with a `count' of~0. A non-zero return value then indicates an
  2320. * error.
  2321. *
  2322. */
  2323. typedef unsigned long
  2324. (*FT_Stream_IoFunc)( FT_Stream stream,
  2325. unsigned long offset,
  2326. unsigned char* buffer,
  2327. unsigned long count );
  2328. /*************************************************************************
  2329. *
  2330. * @functype:
  2331. * FT_Stream_CloseFunc
  2332. *
  2333. * @description:
  2334. * A function used to close a given input stream.
  2335. *
  2336. * @input:
  2337. * stream ::
  2338. * A handle to the target stream.
  2339. *
  2340. */
  2341. typedef void
  2342. (*FT_Stream_CloseFunc)( FT_Stream stream );
  2343. /*************************************************************************
  2344. *
  2345. * @struct:
  2346. * FT_StreamRec
  2347. *
  2348. * @description:
  2349. * A structure used to describe an input stream.
  2350. *
  2351. * @input:
  2352. * base ::
  2353. * For memory-based streams, this is the address of the first stream
  2354. * byte in memory. This field should always be set to NULL for
  2355. * disk-based streams.
  2356. *
  2357. * size ::
  2358. * The stream size in bytes.
  2359. *
  2360. * pos ::
  2361. * The current position within the stream.
  2362. *
  2363. * descriptor ::
  2364. * This field is a union that can hold an integer or a pointer. It is
  2365. * used by stream implementations to store file descriptors or `FILE*'
  2366. * pointers.
  2367. *
  2368. * pathname ::
  2369. * This field is completely ignored by FreeType. However, it is often
  2370. * useful during debugging to use it to store the stream's filename
  2371. * (where available).
  2372. *
  2373. * read ::
  2374. * The stream's input function.
  2375. *
  2376. * close ::
  2377. * The stream's close function.
  2378. *
  2379. * memory ::
  2380. * The memory manager to use to preload frames. This is set
  2381. * internally by FreeType and shouldn't be touched by stream
  2382. * implementations.
  2383. *
  2384. * cursor ::
  2385. * This field is set and used internally by FreeType when parsing
  2386. * frames.
  2387. *
  2388. * limit ::
  2389. * This field is set and used internally by FreeType when parsing
  2390. * frames.
  2391. *
  2392. */
  2393. typedef struct FT_StreamRec_
  2394. {
  2395. unsigned char* base;
  2396. unsigned long size;
  2397. unsigned long pos;
  2398. FT_StreamDesc descriptor;
  2399. FT_StreamDesc pathname;
  2400. FT_Stream_IoFunc read;
  2401. FT_Stream_CloseFunc close;
  2402. FT_Memory memory;
  2403. unsigned char* cursor;
  2404. unsigned char* limit;
  2405. } FT_StreamRec;
  2406. /* */
  2407. FT_END_HEADER
  2408. #endif /* __FTSYSTEM_H__ */
  2409. /* END */
  2410. /*** End of inlined file: ftsystem.h ***/
  2411. /*** Start of inlined file: ftimage.h ***/
  2412. /* */
  2413. /* ftimage.h */
  2414. /* */
  2415. /* FreeType glyph image formats and default raster interface */
  2416. /* (specification). */
  2417. /* */
  2418. /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
  2419. /* 2010 by */
  2420. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  2421. /* */
  2422. /* This file is part of the FreeType project, and may only be used, */
  2423. /* modified, and distributed under the terms of the FreeType project */
  2424. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  2425. /* this file you indicate that you have read the license and */
  2426. /* understand and accept it fully. */
  2427. /* */
  2428. /***************************************************************************/
  2429. /*************************************************************************/
  2430. /* */
  2431. /* Note: A `raster' is simply a scan-line converter, used to render */
  2432. /* FT_Outlines into FT_Bitmaps. */
  2433. /* */
  2434. /*************************************************************************/
  2435. #ifndef __FTIMAGE_H__
  2436. #define __FTIMAGE_H__
  2437. /* _STANDALONE_ is from ftgrays.c */
  2438. #ifndef _STANDALONE_
  2439. #endif
  2440. FT_BEGIN_HEADER
  2441. /*************************************************************************/
  2442. /* */
  2443. /* <Section> */
  2444. /* basic_types */
  2445. /* */
  2446. /*************************************************************************/
  2447. /*************************************************************************/
  2448. /* */
  2449. /* <Type> */
  2450. /* FT_Pos */
  2451. /* */
  2452. /* <Description> */
  2453. /* The type FT_Pos is used to store vectorial coordinates. Depending */
  2454. /* on the context, these can represent distances in integer font */
  2455. /* units, or 16.16, or 26.6 fixed-point pixel coordinates. */
  2456. /* */
  2457. typedef signed long FT_Pos;
  2458. /*************************************************************************/
  2459. /* */
  2460. /* <Struct> */
  2461. /* FT_Vector */
  2462. /* */
  2463. /* <Description> */
  2464. /* A simple structure used to store a 2D vector; coordinates are of */
  2465. /* the FT_Pos type. */
  2466. /* */
  2467. /* <Fields> */
  2468. /* x :: The horizontal coordinate. */
  2469. /* y :: The vertical coordinate. */
  2470. /* */
  2471. typedef struct FT_Vector_
  2472. {
  2473. FT_Pos x;
  2474. FT_Pos y;
  2475. } FT_Vector;
  2476. /*************************************************************************/
  2477. /* */
  2478. /* <Struct> */
  2479. /* FT_BBox */
  2480. /* */
  2481. /* <Description> */
  2482. /* A structure used to hold an outline's bounding box, i.e., the */
  2483. /* coordinates of its extrema in the horizontal and vertical */
  2484. /* directions. */
  2485. /* */
  2486. /* <Fields> */
  2487. /* xMin :: The horizontal minimum (left-most). */
  2488. /* */
  2489. /* yMin :: The vertical minimum (bottom-most). */
  2490. /* */
  2491. /* xMax :: The horizontal maximum (right-most). */
  2492. /* */
  2493. /* yMax :: The vertical maximum (top-most). */
  2494. /* */
  2495. /* <Note> */
  2496. /* The bounding box is specified with the coordinates of the lower */
  2497. /* left and the upper right corner. In PostScript, those values are */
  2498. /* often called (llx,lly) and (urx,ury), respectively. */
  2499. /* */
  2500. /* If `yMin' is negative, this value gives the glyph's descender. */
  2501. /* Otherwise, the glyph doesn't descend below the baseline. */
  2502. /* Similarly, if `ymax' is positive, this value gives the glyph's */
  2503. /* ascender. */
  2504. /* */
  2505. /* `xMin' gives the horizontal distance from the glyph's origin to */
  2506. /* the left edge of the glyph's bounding box. If `xMin' is negative, */
  2507. /* the glyph extends to the left of the origin. */
  2508. /* */
  2509. typedef struct FT_BBox_
  2510. {
  2511. FT_Pos xMin, yMin;
  2512. FT_Pos xMax, yMax;
  2513. } FT_BBox;
  2514. /*************************************************************************/
  2515. /* */
  2516. /* <Enum> */
  2517. /* FT_Pixel_Mode */
  2518. /* */
  2519. /* <Description> */
  2520. /* An enumeration type used to describe the format of pixels in a */
  2521. /* given bitmap. Note that additional formats may be added in the */
  2522. /* future. */
  2523. /* */
  2524. /* <Values> */
  2525. /* FT_PIXEL_MODE_NONE :: */
  2526. /* Value~0 is reserved. */
  2527. /* */
  2528. /* FT_PIXEL_MODE_MONO :: */
  2529. /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */
  2530. /* are stored in most-significant order (MSB), which means that */
  2531. /* the left-most pixel in a byte has value 128. */
  2532. /* */
  2533. /* FT_PIXEL_MODE_GRAY :: */
  2534. /* An 8-bit bitmap, generally used to represent anti-aliased glyph */
  2535. /* images. Each pixel is stored in one byte. Note that the number */
  2536. /* of `gray' levels is stored in the `num_grays' field of the */
  2537. /* @FT_Bitmap structure (it generally is 256). */
  2538. /* */
  2539. /* FT_PIXEL_MODE_GRAY2 :: */
  2540. /* A 2-bit per pixel bitmap, used to represent embedded */
  2541. /* anti-aliased bitmaps in font files according to the OpenType */
  2542. /* specification. We haven't found a single font using this */
  2543. /* format, however. */
  2544. /* */
  2545. /* FT_PIXEL_MODE_GRAY4 :: */
  2546. /* A 4-bit per pixel bitmap, representing embedded anti-aliased */
  2547. /* bitmaps in font files according to the OpenType specification. */
  2548. /* We haven't found a single font using this format, however. */
  2549. /* */
  2550. /* FT_PIXEL_MODE_LCD :: */
  2551. /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
  2552. /* used for display on LCD displays; the bitmap is three times */
  2553. /* wider than the original glyph image. See also */
  2554. /* @FT_RENDER_MODE_LCD. */
  2555. /* */
  2556. /* FT_PIXEL_MODE_LCD_V :: */
  2557. /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
  2558. /* used for display on rotated LCD displays; the bitmap is three */
  2559. /* times taller than the original glyph image. See also */
  2560. /* @FT_RENDER_MODE_LCD_V. */
  2561. /* */
  2562. typedef enum FT_Pixel_Mode_
  2563. {
  2564. FT_PIXEL_MODE_NONE = 0,
  2565. FT_PIXEL_MODE_MONO,
  2566. FT_PIXEL_MODE_GRAY,
  2567. FT_PIXEL_MODE_GRAY2,
  2568. FT_PIXEL_MODE_GRAY4,
  2569. FT_PIXEL_MODE_LCD,
  2570. FT_PIXEL_MODE_LCD_V,
  2571. FT_PIXEL_MODE_MAX /* do not remove */
  2572. } FT_Pixel_Mode;
  2573. /*************************************************************************/
  2574. /* */
  2575. /* <Enum> */
  2576. /* ft_pixel_mode_xxx */
  2577. /* */
  2578. /* <Description> */
  2579. /* A list of deprecated constants. Use the corresponding */
  2580. /* @FT_Pixel_Mode values instead. */
  2581. /* */
  2582. /* <Values> */
  2583. /* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */
  2584. /* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */
  2585. /* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */
  2586. /* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */
  2587. /* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */
  2588. /* */
  2589. #define ft_pixel_mode_none FT_PIXEL_MODE_NONE
  2590. #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
  2591. #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
  2592. #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
  2593. #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
  2594. /* */
  2595. #if 0
  2596. /*************************************************************************/
  2597. /* */
  2598. /* <Enum> */
  2599. /* FT_Palette_Mode */
  2600. /* */
  2601. /* <Description> */
  2602. /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */
  2603. /* */
  2604. /* An enumeration type to describe the format of a bitmap palette, */
  2605. /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */
  2606. /* */
  2607. /* <Values> */
  2608. /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */
  2609. /* records. */
  2610. /* */
  2611. /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */
  2612. /* records. */
  2613. /* */
  2614. /* <Note> */
  2615. /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */
  2616. /* FreeType, these types are not handled by the library itself. */
  2617. /* */
  2618. typedef enum FT_Palette_Mode_
  2619. {
  2620. ft_palette_mode_rgb = 0,
  2621. ft_palette_mode_rgba,
  2622. ft_palette_mode_max /* do not remove */
  2623. } FT_Palette_Mode;
  2624. /* */
  2625. #endif
  2626. /*************************************************************************/
  2627. /* */
  2628. /* <Struct> */
  2629. /* FT_Bitmap */
  2630. /* */
  2631. /* <Description> */
  2632. /* A structure used to describe a bitmap or pixmap to the raster. */
  2633. /* Note that we now manage pixmaps of various depths through the */
  2634. /* `pixel_mode' field. */
  2635. /* */
  2636. /* <Fields> */
  2637. /* rows :: The number of bitmap rows. */
  2638. /* */
  2639. /* width :: The number of pixels in bitmap row. */
  2640. /* */
  2641. /* pitch :: The pitch's absolute value is the number of bytes */
  2642. /* taken by one bitmap row, including padding. */
  2643. /* However, the pitch is positive when the bitmap has */
  2644. /* a `down' flow, and negative when it has an `up' */
  2645. /* flow. In all cases, the pitch is an offset to add */
  2646. /* to a bitmap pointer in order to go down one row. */
  2647. /* */
  2648. /* Note that `padding' means the alignment of a */
  2649. /* bitmap to a byte border, and FreeType functions */
  2650. /* normally align to the smallest possible integer */
  2651. /* value. */
  2652. /* */
  2653. /* For the B/W rasterizer, `pitch' is always an even */
  2654. /* number. */
  2655. /* */
  2656. /* To change the pitch of a bitmap (say, to make it a */
  2657. /* multiple of 4), use @FT_Bitmap_Convert. */
  2658. /* Alternatively, you might use callback functions to */
  2659. /* directly render to the application's surface; see */
  2660. /* the file `example2.cpp' in the tutorial for a */
  2661. /* demonstration. */
  2662. /* */
  2663. /* buffer :: A typeless pointer to the bitmap buffer. This */
  2664. /* value should be aligned on 32-bit boundaries in */
  2665. /* most cases. */
  2666. /* */
  2667. /* num_grays :: This field is only used with */
  2668. /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */
  2669. /* levels used in the bitmap. */
  2670. /* */
  2671. /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */
  2672. /* See @FT_Pixel_Mode for possible values. */
  2673. /* */
  2674. /* palette_mode :: This field is intended for paletted pixel modes; */
  2675. /* it indicates how the palette is stored. Not */
  2676. /* used currently. */
  2677. /* */
  2678. /* palette :: A typeless pointer to the bitmap palette; this */
  2679. /* field is intended for paletted pixel modes. Not */
  2680. /* used currently. */
  2681. /* */
  2682. /* <Note> */
  2683. /* For now, the only pixel modes supported by FreeType are mono and */
  2684. /* grays. However, drivers might be added in the future to support */
  2685. /* more `colorful' options. */
  2686. /* */
  2687. typedef struct FT_Bitmap_
  2688. {
  2689. int rows;
  2690. int width;
  2691. int pitch;
  2692. unsigned char* buffer;
  2693. short num_grays;
  2694. char pixel_mode;
  2695. char palette_mode;
  2696. void* palette;
  2697. } FT_Bitmap;
  2698. /*************************************************************************/
  2699. /* */
  2700. /* <Section> */
  2701. /* outline_processing */
  2702. /* */
  2703. /*************************************************************************/
  2704. /*************************************************************************/
  2705. /* */
  2706. /* <Struct> */
  2707. /* FT_Outline */
  2708. /* */
  2709. /* <Description> */
  2710. /* This structure is used to describe an outline to the scan-line */
  2711. /* converter. */
  2712. /* */
  2713. /* <Fields> */
  2714. /* n_contours :: The number of contours in the outline. */
  2715. /* */
  2716. /* n_points :: The number of points in the outline. */
  2717. /* */
  2718. /* points :: A pointer to an array of `n_points' @FT_Vector */
  2719. /* elements, giving the outline's point coordinates. */
  2720. /* */
  2721. /* tags :: A pointer to an array of `n_points' chars, giving */
  2722. /* each outline point's type. */
  2723. /* */
  2724. /* If bit~0 is unset, the point is `off' the curve, */
  2725. /* i.e., a Bézier control point, while it is `on' if */
  2726. /* set. */
  2727. /* */
  2728. /* Bit~1 is meaningful for `off' points only. If set, */
  2729. /* it indicates a third-order Bézier arc control point; */
  2730. /* and a second-order control point if unset. */
  2731. /* */
  2732. /* If bit~2 is set, bits 5-7 contain the drop-out mode */
  2733. /* (as defined in the OpenType specification; the value */
  2734. /* is the same as the argument to the SCANMODE */
  2735. /* instruction). */
  2736. /* */
  2737. /* Bits 3 and~4 are reserved for internal purposes. */
  2738. /* */
  2739. /* contours :: An array of `n_contours' shorts, giving the end */
  2740. /* point of each contour within the outline. For */
  2741. /* example, the first contour is defined by the points */
  2742. /* `0' to `contours[0]', the second one is defined by */
  2743. /* the points `contours[0]+1' to `contours[1]', etc. */
  2744. /* */
  2745. /* flags :: A set of bit flags used to characterize the outline */
  2746. /* and give hints to the scan-converter and hinter on */
  2747. /* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */
  2748. /* */
  2749. /* <Note> */
  2750. /* The B/W rasterizer only checks bit~2 in the `tags' array for the */
  2751. /* first point of each contour. The drop-out mode as given with */
  2752. /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */
  2753. /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */
  2754. /* */
  2755. typedef struct FT_Outline_
  2756. {
  2757. short n_contours; /* number of contours in glyph */
  2758. short n_points; /* number of points in the glyph */
  2759. FT_Vector* points; /* the outline's points */
  2760. char* tags; /* the points flags */
  2761. short* contours; /* the contour end points */
  2762. int flags; /* outline masks */
  2763. } FT_Outline;
  2764. /* Following limits must be consistent with */
  2765. /* FT_Outline.{n_contours,n_points} */
  2766. #define FT_OUTLINE_CONTOURS_MAX SHRT_MAX
  2767. #define FT_OUTLINE_POINTS_MAX SHRT_MAX
  2768. /*************************************************************************/
  2769. /* */
  2770. /* <Enum> */
  2771. /* FT_OUTLINE_FLAGS */
  2772. /* */
  2773. /* <Description> */
  2774. /* A list of bit-field constants use for the flags in an outline's */
  2775. /* `flags' field. */
  2776. /* */
  2777. /* <Values> */
  2778. /* FT_OUTLINE_NONE :: */
  2779. /* Value~0 is reserved. */
  2780. /* */
  2781. /* FT_OUTLINE_OWNER :: */
  2782. /* If set, this flag indicates that the outline's field arrays */
  2783. /* (i.e., `points', `flags', and `contours') are `owned' by the */
  2784. /* outline object, and should thus be freed when it is destroyed. */
  2785. /* */
  2786. /* FT_OUTLINE_EVEN_ODD_FILL :: */
  2787. /* By default, outlines are filled using the non-zero winding rule. */
  2788. /* If set to 1, the outline will be filled using the even-odd fill */
  2789. /* rule (only works with the smooth rasterizer). */
  2790. /* */
  2791. /* FT_OUTLINE_REVERSE_FILL :: */
  2792. /* By default, outside contours of an outline are oriented in */
  2793. /* clock-wise direction, as defined in the TrueType specification. */
  2794. /* This flag is set if the outline uses the opposite direction */
  2795. /* (typically for Type~1 fonts). This flag is ignored by the scan */
  2796. /* converter. */
  2797. /* */
  2798. /* FT_OUTLINE_IGNORE_DROPOUTS :: */
  2799. /* By default, the scan converter will try to detect drop-outs in */
  2800. /* an outline and correct the glyph bitmap to ensure consistent */
  2801. /* shape continuity. If set, this flag hints the scan-line */
  2802. /* converter to ignore such cases. See below for more information. */
  2803. /* */
  2804. /* FT_OUTLINE_SMART_DROPOUTS :: */
  2805. /* Select smart dropout control. If unset, use simple dropout */
  2806. /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */
  2807. /* below for more information. */
  2808. /* */
  2809. /* FT_OUTLINE_INCLUDE_STUBS :: */
  2810. /* If set, turn pixels on for `stubs', otherwise exclude them. */
  2811. /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */
  2812. /* more information. */
  2813. /* */
  2814. /* FT_OUTLINE_HIGH_PRECISION :: */
  2815. /* This flag indicates that the scan-line converter should try to */
  2816. /* convert this outline to bitmaps with the highest possible */
  2817. /* quality. It is typically set for small character sizes. Note */
  2818. /* that this is only a hint that might be completely ignored by a */
  2819. /* given scan-converter. */
  2820. /* */
  2821. /* FT_OUTLINE_SINGLE_PASS :: */
  2822. /* This flag is set to force a given scan-converter to only use a */
  2823. /* single pass over the outline to render a bitmap glyph image. */
  2824. /* Normally, it is set for very large character sizes. It is only */
  2825. /* a hint that might be completely ignored by a given */
  2826. /* scan-converter. */
  2827. /* */
  2828. /* <Note> */
  2829. /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
  2830. /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */
  2831. /* rasterizer. */
  2832. /* */
  2833. /* There exists a second mechanism to pass the drop-out mode to the */
  2834. /* B/W rasterizer; see the `tags' field in @FT_Outline. */
  2835. /* */
  2836. /* Please refer to the description of the `SCANTYPE' instruction in */
  2837. /* the OpenType specification (in file `ttinst1.doc') how simple */
  2838. /* drop-outs, smart drop-outs, and stubs are defined. */
  2839. /* */
  2840. #define FT_OUTLINE_NONE 0x0
  2841. #define FT_OUTLINE_OWNER 0x1
  2842. #define FT_OUTLINE_EVEN_ODD_FILL 0x2
  2843. #define FT_OUTLINE_REVERSE_FILL 0x4
  2844. #define FT_OUTLINE_IGNORE_DROPOUTS 0x8
  2845. #define FT_OUTLINE_SMART_DROPOUTS 0x10
  2846. #define FT_OUTLINE_INCLUDE_STUBS 0x20
  2847. #define FT_OUTLINE_HIGH_PRECISION 0x100
  2848. #define FT_OUTLINE_SINGLE_PASS 0x200
  2849. /*************************************************************************
  2850. *
  2851. * @enum:
  2852. * ft_outline_flags
  2853. *
  2854. * @description:
  2855. * These constants are deprecated. Please use the corresponding
  2856. * @FT_OUTLINE_FLAGS values.
  2857. *
  2858. * @values:
  2859. * ft_outline_none :: See @FT_OUTLINE_NONE.
  2860. * ft_outline_owner :: See @FT_OUTLINE_OWNER.
  2861. * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL.
  2862. * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL.
  2863. * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.
  2864. * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION.
  2865. * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS.
  2866. */
  2867. #define ft_outline_none FT_OUTLINE_NONE
  2868. #define ft_outline_owner FT_OUTLINE_OWNER
  2869. #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL
  2870. #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL
  2871. #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS
  2872. #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION
  2873. #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS
  2874. /* */
  2875. #define FT_CURVE_TAG( flag ) ( flag & 3 )
  2876. #define FT_CURVE_TAG_ON 1
  2877. #define FT_CURVE_TAG_CONIC 0
  2878. #define FT_CURVE_TAG_CUBIC 2
  2879. #define FT_CURVE_TAG_HAS_SCANMODE 4
  2880. #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */
  2881. #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */
  2882. #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \
  2883. FT_CURVE_TAG_TOUCH_Y )
  2884. #define FT_Curve_Tag_On FT_CURVE_TAG_ON
  2885. #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC
  2886. #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC
  2887. #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X
  2888. #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y
  2889. /*************************************************************************/
  2890. /* */
  2891. /* <FuncType> */
  2892. /* FT_Outline_MoveToFunc */
  2893. /* */
  2894. /* <Description> */
  2895. /* A function pointer type used to describe the signature of a `move */
  2896. /* to' function during outline walking/decomposition. */
  2897. /* */
  2898. /* A `move to' is emitted to start a new contour in an outline. */
  2899. /* */
  2900. /* <Input> */
  2901. /* to :: A pointer to the target point of the `move to'. */
  2902. /* */
  2903. /* user :: A typeless pointer which is passed from the caller of the */
  2904. /* decomposition function. */
  2905. /* */
  2906. /* <Return> */
  2907. /* Error code. 0~means success. */
  2908. /* */
  2909. typedef int
  2910. (*FT_Outline_MoveToFunc)( const FT_Vector* to,
  2911. void* user );
  2912. #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc
  2913. /*************************************************************************/
  2914. /* */
  2915. /* <FuncType> */
  2916. /* FT_Outline_LineToFunc */
  2917. /* */
  2918. /* <Description> */
  2919. /* A function pointer type used to describe the signature of a `line */
  2920. /* to' function during outline walking/decomposition. */
  2921. /* */
  2922. /* A `line to' is emitted to indicate a segment in the outline. */
  2923. /* */
  2924. /* <Input> */
  2925. /* to :: A pointer to the target point of the `line to'. */
  2926. /* */
  2927. /* user :: A typeless pointer which is passed from the caller of the */
  2928. /* decomposition function. */
  2929. /* */
  2930. /* <Return> */
  2931. /* Error code. 0~means success. */
  2932. /* */
  2933. typedef int
  2934. (*FT_Outline_LineToFunc)( const FT_Vector* to,
  2935. void* user );
  2936. #define FT_Outline_LineTo_Func FT_Outline_LineToFunc
  2937. /*************************************************************************/
  2938. /* */
  2939. /* <FuncType> */
  2940. /* FT_Outline_ConicToFunc */
  2941. /* */
  2942. /* <Description> */
  2943. /* A function pointer type used to describe the signature of a `conic */
  2944. /* to' function during outline walking or decomposition. */
  2945. /* */
  2946. /* A `conic to' is emitted to indicate a second-order Bézier arc in */
  2947. /* the outline. */
  2948. /* */
  2949. /* <Input> */
  2950. /* control :: An intermediate control point between the last position */
  2951. /* and the new target in `to'. */
  2952. /* */
  2953. /* to :: A pointer to the target end point of the conic arc. */
  2954. /* */
  2955. /* user :: A typeless pointer which is passed from the caller of */
  2956. /* the decomposition function. */
  2957. /* */
  2958. /* <Return> */
  2959. /* Error code. 0~means success. */
  2960. /* */
  2961. typedef int
  2962. (*FT_Outline_ConicToFunc)( const FT_Vector* control,
  2963. const FT_Vector* to,
  2964. void* user );
  2965. #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc
  2966. /*************************************************************************/
  2967. /* */
  2968. /* <FuncType> */
  2969. /* FT_Outline_CubicToFunc */
  2970. /* */
  2971. /* <Description> */
  2972. /* A function pointer type used to describe the signature of a `cubic */
  2973. /* to' function during outline walking or decomposition. */
  2974. /* */
  2975. /* A `cubic to' is emitted to indicate a third-order Bézier arc. */
  2976. /* */
  2977. /* <Input> */
  2978. /* control1 :: A pointer to the first Bézier control point. */
  2979. /* */
  2980. /* control2 :: A pointer to the second Bézier control point. */
  2981. /* */
  2982. /* to :: A pointer to the target end point. */
  2983. /* */
  2984. /* user :: A typeless pointer which is passed from the caller of */
  2985. /* the decomposition function. */
  2986. /* */
  2987. /* <Return> */
  2988. /* Error code. 0~means success. */
  2989. /* */
  2990. typedef int
  2991. (*FT_Outline_CubicToFunc)( const FT_Vector* control1,
  2992. const FT_Vector* control2,
  2993. const FT_Vector* to,
  2994. void* user );
  2995. #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc
  2996. /*************************************************************************/
  2997. /* */
  2998. /* <Struct> */
  2999. /* FT_Outline_Funcs */
  3000. /* */
  3001. /* <Description> */
  3002. /* A structure to hold various function pointers used during outline */
  3003. /* decomposition in order to emit segments, conic, and cubic Béziers. */
  3004. /* */
  3005. /* <Fields> */
  3006. /* move_to :: The `move to' emitter. */
  3007. /* */
  3008. /* line_to :: The segment emitter. */
  3009. /* */
  3010. /* conic_to :: The second-order Bézier arc emitter. */
  3011. /* */
  3012. /* cubic_to :: The third-order Bézier arc emitter. */
  3013. /* */
  3014. /* shift :: The shift that is applied to coordinates before they */
  3015. /* are sent to the emitter. */
  3016. /* */
  3017. /* delta :: The delta that is applied to coordinates before they */
  3018. /* are sent to the emitter, but after the shift. */
  3019. /* */
  3020. /* <Note> */
  3021. /* The point coordinates sent to the emitters are the transformed */
  3022. /* version of the original coordinates (this is important for high */
  3023. /* accuracy during scan-conversion). The transformation is simple: */
  3024. /* */
  3025. /* { */
  3026. /* x' = (x << shift) - delta */
  3027. /* y' = (x << shift) - delta */
  3028. /* } */
  3029. /* */
  3030. /* Set the values of `shift' and `delta' to~0 to get the original */
  3031. /* point coordinates. */
  3032. /* */
  3033. typedef struct FT_Outline_Funcs_
  3034. {
  3035. FT_Outline_MoveToFunc move_to;
  3036. FT_Outline_LineToFunc line_to;
  3037. FT_Outline_ConicToFunc conic_to;
  3038. FT_Outline_CubicToFunc cubic_to;
  3039. int shift;
  3040. FT_Pos delta;
  3041. } FT_Outline_Funcs;
  3042. /*************************************************************************/
  3043. /* */
  3044. /* <Section> */
  3045. /* basic_types */
  3046. /* */
  3047. /*************************************************************************/
  3048. /*************************************************************************/
  3049. /* */
  3050. /* <Macro> */
  3051. /* FT_IMAGE_TAG */
  3052. /* */
  3053. /* <Description> */
  3054. /* This macro converts four-letter tags to an unsigned long type. */
  3055. /* */
  3056. /* <Note> */
  3057. /* Since many 16-bit compilers don't like 32-bit enumerations, you */
  3058. /* should redefine this macro in case of problems to something like */
  3059. /* this: */
  3060. /* */
  3061. /* { */
  3062. /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
  3063. /* } */
  3064. /* */
  3065. /* to get a simple enumeration without assigning special numbers. */
  3066. /* */
  3067. #ifndef FT_IMAGE_TAG
  3068. #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
  3069. value = ( ( (unsigned long)_x1 << 24 ) | \
  3070. ( (unsigned long)_x2 << 16 ) | \
  3071. ( (unsigned long)_x3 << 8 ) | \
  3072. (unsigned long)_x4 )
  3073. #endif /* FT_IMAGE_TAG */
  3074. /*************************************************************************/
  3075. /* */
  3076. /* <Enum> */
  3077. /* FT_Glyph_Format */
  3078. /* */
  3079. /* <Description> */
  3080. /* An enumeration type used to describe the format of a given glyph */
  3081. /* image. Note that this version of FreeType only supports two image */
  3082. /* formats, even though future font drivers will be able to register */
  3083. /* their own format. */
  3084. /* */
  3085. /* <Values> */
  3086. /* FT_GLYPH_FORMAT_NONE :: */
  3087. /* The value~0 is reserved. */
  3088. /* */
  3089. /* FT_GLYPH_FORMAT_COMPOSITE :: */
  3090. /* The glyph image is a composite of several other images. This */
  3091. /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */
  3092. /* report compound glyphs (like accented characters). */
  3093. /* */
  3094. /* FT_GLYPH_FORMAT_BITMAP :: */
  3095. /* The glyph image is a bitmap, and can be described as an */
  3096. /* @FT_Bitmap. You generally need to access the `bitmap' field of */
  3097. /* the @FT_GlyphSlotRec structure to read it. */
  3098. /* */
  3099. /* FT_GLYPH_FORMAT_OUTLINE :: */
  3100. /* The glyph image is a vectorial outline made of line segments */
  3101. /* and Bézier arcs; it can be described as an @FT_Outline; you */
  3102. /* generally want to access the `outline' field of the */
  3103. /* @FT_GlyphSlotRec structure to read it. */
  3104. /* */
  3105. /* FT_GLYPH_FORMAT_PLOTTER :: */
  3106. /* The glyph image is a vectorial path with no inside and outside */
  3107. /* contours. Some Type~1 fonts, like those in the Hershey family, */
  3108. /* contain glyphs in this format. These are described as */
  3109. /* @FT_Outline, but FreeType isn't currently capable of rendering */
  3110. /* them correctly. */
  3111. /* */
  3112. typedef enum FT_Glyph_Format_
  3113. {
  3114. FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
  3115. FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
  3116. FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
  3117. FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
  3118. FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
  3119. } FT_Glyph_Format;
  3120. /*************************************************************************/
  3121. /* */
  3122. /* <Enum> */
  3123. /* ft_glyph_format_xxx */
  3124. /* */
  3125. /* <Description> */
  3126. /* A list of deprecated constants. Use the corresponding */
  3127. /* @FT_Glyph_Format values instead. */
  3128. /* */
  3129. /* <Values> */
  3130. /* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */
  3131. /* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */
  3132. /* ft_glyph_format_bitmap :: See @FT_GLYPH_FORMAT_BITMAP. */
  3133. /* ft_glyph_format_outline :: See @FT_GLYPH_FORMAT_OUTLINE. */
  3134. /* ft_glyph_format_plotter :: See @FT_GLYPH_FORMAT_PLOTTER. */
  3135. /* */
  3136. #define ft_glyph_format_none FT_GLYPH_FORMAT_NONE
  3137. #define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE
  3138. #define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP
  3139. #define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
  3140. #define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
  3141. /*************************************************************************/
  3142. /*************************************************************************/
  3143. /*************************************************************************/
  3144. /***** *****/
  3145. /***** R A S T E R D E F I N I T I O N S *****/
  3146. /***** *****/
  3147. /*************************************************************************/
  3148. /*************************************************************************/
  3149. /*************************************************************************/
  3150. /*************************************************************************/
  3151. /* */
  3152. /* A raster is a scan converter, in charge of rendering an outline into */
  3153. /* a a bitmap. This section contains the public API for rasters. */
  3154. /* */
  3155. /* Note that in FreeType 2, all rasters are now encapsulated within */
  3156. /* specific modules called `renderers'. See `freetype/ftrender.h' for */
  3157. /* more details on renderers. */
  3158. /* */
  3159. /*************************************************************************/
  3160. /*************************************************************************/
  3161. /* */
  3162. /* <Section> */
  3163. /* raster */
  3164. /* */
  3165. /* <Title> */
  3166. /* Scanline Converter */
  3167. /* */
  3168. /* <Abstract> */
  3169. /* How vectorial outlines are converted into bitmaps and pixmaps. */
  3170. /* */
  3171. /* <Description> */
  3172. /* This section contains technical definitions. */
  3173. /* */
  3174. /*************************************************************************/
  3175. /*************************************************************************/
  3176. /* */
  3177. /* <Type> */
  3178. /* FT_Raster */
  3179. /* */
  3180. /* <Description> */
  3181. /* A handle (pointer) to a raster object. Each object can be used */
  3182. /* independently to convert an outline into a bitmap or pixmap. */
  3183. /* */
  3184. typedef struct FT_RasterRec_* FT_Raster;
  3185. /*************************************************************************/
  3186. /* */
  3187. /* <Struct> */
  3188. /* FT_Span */
  3189. /* */
  3190. /* <Description> */
  3191. /* A structure used to model a single span of gray (or black) pixels */
  3192. /* when rendering a monochrome or anti-aliased bitmap. */
  3193. /* */
  3194. /* <Fields> */
  3195. /* x :: The span's horizontal start position. */
  3196. /* */
  3197. /* len :: The span's length in pixels. */
  3198. /* */
  3199. /* coverage :: The span color/coverage, ranging from 0 (background) */
  3200. /* to 255 (foreground). Only used for anti-aliased */
  3201. /* rendering. */
  3202. /* */
  3203. /* <Note> */
  3204. /* This structure is used by the span drawing callback type named */
  3205. /* @FT_SpanFunc which takes the y~coordinate of the span as a */
  3206. /* a parameter. */
  3207. /* */
  3208. /* The coverage value is always between 0 and 255. If you want less */
  3209. /* gray values, the callback function has to reduce them. */
  3210. /* */
  3211. typedef struct FT_Span_
  3212. {
  3213. short x;
  3214. unsigned short len;
  3215. unsigned char coverage;
  3216. } FT_Span;
  3217. /*************************************************************************/
  3218. /* */
  3219. /* <FuncType> */
  3220. /* FT_SpanFunc */
  3221. /* */
  3222. /* <Description> */
  3223. /* A function used as a call-back by the anti-aliased renderer in */
  3224. /* order to let client applications draw themselves the gray pixel */
  3225. /* spans on each scan line. */
  3226. /* */
  3227. /* <Input> */
  3228. /* y :: The scanline's y~coordinate. */
  3229. /* */
  3230. /* count :: The number of spans to draw on this scanline. */
  3231. /* */
  3232. /* spans :: A table of `count' spans to draw on the scanline. */
  3233. /* */
  3234. /* user :: User-supplied data that is passed to the callback. */
  3235. /* */
  3236. /* <Note> */
  3237. /* This callback allows client applications to directly render the */
  3238. /* gray spans of the anti-aliased bitmap to any kind of surfaces. */
  3239. /* */
  3240. /* This can be used to write anti-aliased outlines directly to a */
  3241. /* given background bitmap, and even perform translucency. */
  3242. /* */
  3243. /* Note that the `count' field cannot be greater than a fixed value */
  3244. /* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */
  3245. /* `ftoption.h'. By default, this value is set to~32, which means */
  3246. /* that if there are more than 32~spans on a given scanline, the */
  3247. /* callback is called several times with the same `y' parameter in */
  3248. /* order to draw all callbacks. */
  3249. /* */
  3250. /* Otherwise, the callback is only called once per scan-line, and */
  3251. /* only for those scanlines that do have `gray' pixels on them. */
  3252. /* */
  3253. typedef void
  3254. (*FT_SpanFunc)( int y,
  3255. int count,
  3256. const FT_Span* spans,
  3257. void* user );
  3258. #define FT_Raster_Span_Func FT_SpanFunc
  3259. /*************************************************************************/
  3260. /* */
  3261. /* <FuncType> */
  3262. /* FT_Raster_BitTest_Func */
  3263. /* */
  3264. /* <Description> */
  3265. /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */
  3266. /* */
  3267. /* A function used as a call-back by the monochrome scan-converter */
  3268. /* to test whether a given target pixel is already set to the drawing */
  3269. /* `color'. These tests are crucial to implement drop-out control */
  3270. /* per-se the TrueType spec. */
  3271. /* */
  3272. /* <Input> */
  3273. /* y :: The pixel's y~coordinate. */
  3274. /* */
  3275. /* x :: The pixel's x~coordinate. */
  3276. /* */
  3277. /* user :: User-supplied data that is passed to the callback. */
  3278. /* */
  3279. /* <Return> */
  3280. /* 1~if the pixel is `set', 0~otherwise. */
  3281. /* */
  3282. typedef int
  3283. (*FT_Raster_BitTest_Func)( int y,
  3284. int x,
  3285. void* user );
  3286. /*************************************************************************/
  3287. /* */
  3288. /* <FuncType> */
  3289. /* FT_Raster_BitSet_Func */
  3290. /* */
  3291. /* <Description> */
  3292. /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */
  3293. /* */
  3294. /* A function used as a call-back by the monochrome scan-converter */
  3295. /* to set an individual target pixel. This is crucial to implement */
  3296. /* drop-out control according to the TrueType specification. */
  3297. /* */
  3298. /* <Input> */
  3299. /* y :: The pixel's y~coordinate. */
  3300. /* */
  3301. /* x :: The pixel's x~coordinate. */
  3302. /* */
  3303. /* user :: User-supplied data that is passed to the callback. */
  3304. /* */
  3305. /* <Return> */
  3306. /* 1~if the pixel is `set', 0~otherwise. */
  3307. /* */
  3308. typedef void
  3309. (*FT_Raster_BitSet_Func)( int y,
  3310. int x,
  3311. void* user );
  3312. /*************************************************************************/
  3313. /* */
  3314. /* <Enum> */
  3315. /* FT_RASTER_FLAG_XXX */
  3316. /* */
  3317. /* <Description> */
  3318. /* A list of bit flag constants as used in the `flags' field of a */
  3319. /* @FT_Raster_Params structure. */
  3320. /* */
  3321. /* <Values> */
  3322. /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */
  3323. /* */
  3324. /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
  3325. /* anti-aliased glyph image should be */
  3326. /* generated. Otherwise, it will be */
  3327. /* monochrome (1-bit). */
  3328. /* */
  3329. /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
  3330. /* rendering. In this mode, client */
  3331. /* applications must provide their own span */
  3332. /* callback. This lets them directly */
  3333. /* draw or compose over an existing bitmap. */
  3334. /* If this bit is not set, the target */
  3335. /* pixmap's buffer _must_ be zeroed before */
  3336. /* rendering. */
  3337. /* */
  3338. /* Note that for now, direct rendering is */
  3339. /* only possible with anti-aliased glyphs. */
  3340. /* */
  3341. /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */
  3342. /* rendering mode. If set, the output will */
  3343. /* be clipped to a box specified in the */
  3344. /* `clip_box' field of the */
  3345. /* @FT_Raster_Params structure. */
  3346. /* */
  3347. /* Note that by default, the glyph bitmap */
  3348. /* is clipped to the target pixmap, except */
  3349. /* in direct rendering mode where all spans */
  3350. /* are generated if no clipping box is set. */
  3351. /* */
  3352. #define FT_RASTER_FLAG_DEFAULT 0x0
  3353. #define FT_RASTER_FLAG_AA 0x1
  3354. #define FT_RASTER_FLAG_DIRECT 0x2
  3355. #define FT_RASTER_FLAG_CLIP 0x4
  3356. /* deprecated */
  3357. #define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT
  3358. #define ft_raster_flag_aa FT_RASTER_FLAG_AA
  3359. #define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT
  3360. #define ft_raster_flag_clip FT_RASTER_FLAG_CLIP
  3361. /*************************************************************************/
  3362. /* */
  3363. /* <Struct> */
  3364. /* FT_Raster_Params */
  3365. /* */
  3366. /* <Description> */
  3367. /* A structure to hold the arguments used by a raster's render */
  3368. /* function. */
  3369. /* */
  3370. /* <Fields> */
  3371. /* target :: The target bitmap. */
  3372. /* */
  3373. /* source :: A pointer to the source glyph image (e.g., an */
  3374. /* @FT_Outline). */
  3375. /* */
  3376. /* flags :: The rendering flags. */
  3377. /* */
  3378. /* gray_spans :: The gray span drawing callback. */
  3379. /* */
  3380. /* black_spans :: The black span drawing callback. UNIMPLEMENTED! */
  3381. /* */
  3382. /* bit_test :: The bit test callback. UNIMPLEMENTED! */
  3383. /* */
  3384. /* bit_set :: The bit set callback. UNIMPLEMENTED! */
  3385. /* */
  3386. /* user :: User-supplied data that is passed to each drawing */
  3387. /* callback. */
  3388. /* */
  3389. /* clip_box :: An optional clipping box. It is only used in */
  3390. /* direct rendering mode. Note that coordinates here */
  3391. /* should be expressed in _integer_ pixels (and not in */
  3392. /* 26.6 fixed-point units). */
  3393. /* */
  3394. /* <Note> */
  3395. /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */
  3396. /* bit flag is set in the `flags' field, otherwise a monochrome */
  3397. /* bitmap is generated. */
  3398. /* */
  3399. /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */
  3400. /* raster will call the `gray_spans' callback to draw gray pixel */
  3401. /* spans, in the case of an aa glyph bitmap, it will call */
  3402. /* `black_spans', and `bit_test' and `bit_set' in the case of a */
  3403. /* monochrome bitmap. This allows direct composition over a */
  3404. /* pre-existing bitmap through user-provided callbacks to perform the */
  3405. /* span drawing/composition. */
  3406. /* */
  3407. /* Note that the `bit_test' and `bit_set' callbacks are required when */
  3408. /* rendering a monochrome bitmap, as they are crucial to implement */
  3409. /* correct drop-out control as defined in the TrueType specification. */
  3410. /* */
  3411. typedef struct FT_Raster_Params_
  3412. {
  3413. const FT_Bitmap* target;
  3414. const void* source;
  3415. int flags;
  3416. FT_SpanFunc gray_spans;
  3417. FT_SpanFunc black_spans; /* doesn't work! */
  3418. FT_Raster_BitTest_Func bit_test; /* doesn't work! */
  3419. FT_Raster_BitSet_Func bit_set; /* doesn't work! */
  3420. void* user;
  3421. FT_BBox clip_box;
  3422. } FT_Raster_Params;
  3423. /*************************************************************************/
  3424. /* */
  3425. /* <FuncType> */
  3426. /* FT_Raster_NewFunc */
  3427. /* */
  3428. /* <Description> */
  3429. /* A function used to create a new raster object. */
  3430. /* */
  3431. /* <Input> */
  3432. /* memory :: A handle to the memory allocator. */
  3433. /* */
  3434. /* <Output> */
  3435. /* raster :: A handle to the new raster object. */
  3436. /* */
  3437. /* <Return> */
  3438. /* Error code. 0~means success. */
  3439. /* */
  3440. /* <Note> */
  3441. /* The `memory' parameter is a typeless pointer in order to avoid */
  3442. /* un-wanted dependencies on the rest of the FreeType code. In */
  3443. /* practice, it is an @FT_Memory object, i.e., a handle to the */
  3444. /* standard FreeType memory allocator. However, this field can be */
  3445. /* completely ignored by a given raster implementation. */
  3446. /* */
  3447. typedef int
  3448. (*FT_Raster_NewFunc)( void* memory,
  3449. FT_Raster* raster );
  3450. #define FT_Raster_New_Func FT_Raster_NewFunc
  3451. /*************************************************************************/
  3452. /* */
  3453. /* <FuncType> */
  3454. /* FT_Raster_DoneFunc */
  3455. /* */
  3456. /* <Description> */
  3457. /* A function used to destroy a given raster object. */
  3458. /* */
  3459. /* <Input> */
  3460. /* raster :: A handle to the raster object. */
  3461. /* */
  3462. typedef void
  3463. (*FT_Raster_DoneFunc)( FT_Raster raster );
  3464. #define FT_Raster_Done_Func FT_Raster_DoneFunc
  3465. /*************************************************************************/
  3466. /* */
  3467. /* <FuncType> */
  3468. /* FT_Raster_ResetFunc */
  3469. /* */
  3470. /* <Description> */
  3471. /* FreeType provides an area of memory called the `render pool', */
  3472. /* available to all registered rasters. This pool can be freely used */
  3473. /* during a given scan-conversion but is shared by all rasters. Its */
  3474. /* content is thus transient. */
  3475. /* */
  3476. /* This function is called each time the render pool changes, or just */
  3477. /* after a new raster object is created. */
  3478. /* */
  3479. /* <Input> */
  3480. /* raster :: A handle to the new raster object. */
  3481. /* */
  3482. /* pool_base :: The address in memory of the render pool. */
  3483. /* */
  3484. /* pool_size :: The size in bytes of the render pool. */
  3485. /* */
  3486. /* <Note> */
  3487. /* Rasters can ignore the render pool and rely on dynamic memory */
  3488. /* allocation if they want to (a handle to the memory allocator is */
  3489. /* passed to the raster constructor). However, this is not */
  3490. /* recommended for efficiency purposes. */
  3491. /* */
  3492. typedef void
  3493. (*FT_Raster_ResetFunc)( FT_Raster raster,
  3494. unsigned char* pool_base,
  3495. unsigned long pool_size );
  3496. #define FT_Raster_Reset_Func FT_Raster_ResetFunc
  3497. /*************************************************************************/
  3498. /* */
  3499. /* <FuncType> */
  3500. /* FT_Raster_SetModeFunc */
  3501. /* */
  3502. /* <Description> */
  3503. /* This function is a generic facility to change modes or attributes */
  3504. /* in a given raster. This can be used for debugging purposes, or */
  3505. /* simply to allow implementation-specific `features' in a given */
  3506. /* raster module. */
  3507. /* */
  3508. /* <Input> */
  3509. /* raster :: A handle to the new raster object. */
  3510. /* */
  3511. /* mode :: A 4-byte tag used to name the mode or property. */
  3512. /* */
  3513. /* args :: A pointer to the new mode/property to use. */
  3514. /* */
  3515. typedef int
  3516. (*FT_Raster_SetModeFunc)( FT_Raster raster,
  3517. unsigned long mode,
  3518. void* args );
  3519. #define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc
  3520. /*************************************************************************/
  3521. /* */
  3522. /* <FuncType> */
  3523. /* FT_Raster_RenderFunc */
  3524. /* */
  3525. /* <Description> */
  3526. /* Invoke a given raster to scan-convert a given glyph image into a */
  3527. /* target bitmap. */
  3528. /* */
  3529. /* <Input> */
  3530. /* raster :: A handle to the raster object. */
  3531. /* */
  3532. /* params :: A pointer to an @FT_Raster_Params structure used to */
  3533. /* store the rendering parameters. */
  3534. /* */
  3535. /* <Return> */
  3536. /* Error code. 0~means success. */
  3537. /* */
  3538. /* <Note> */
  3539. /* The exact format of the source image depends on the raster's glyph */
  3540. /* format defined in its @FT_Raster_Funcs structure. It can be an */
  3541. /* @FT_Outline or anything else in order to support a large array of */
  3542. /* glyph formats. */
  3543. /* */
  3544. /* Note also that the render function can fail and return a */
  3545. /* `FT_Err_Unimplemented_Feature' error code if the raster used does */
  3546. /* not support direct composition. */
  3547. /* */
  3548. /* XXX: For now, the standard raster doesn't support direct */
  3549. /* composition but this should change for the final release (see */
  3550. /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */
  3551. /* for examples of distinct implementations which support direct */
  3552. /* composition). */
  3553. /* */
  3554. typedef int
  3555. (*FT_Raster_RenderFunc)( FT_Raster raster,
  3556. const FT_Raster_Params* params );
  3557. #define FT_Raster_Render_Func FT_Raster_RenderFunc
  3558. /*************************************************************************/
  3559. /* */
  3560. /* <Struct> */
  3561. /* FT_Raster_Funcs */
  3562. /* */
  3563. /* <Description> */
  3564. /* A structure used to describe a given raster class to the library. */
  3565. /* */
  3566. /* <Fields> */
  3567. /* glyph_format :: The supported glyph format for this raster. */
  3568. /* */
  3569. /* raster_new :: The raster constructor. */
  3570. /* */
  3571. /* raster_reset :: Used to reset the render pool within the raster. */
  3572. /* */
  3573. /* raster_render :: A function to render a glyph into a given bitmap. */
  3574. /* */
  3575. /* raster_done :: The raster destructor. */
  3576. /* */
  3577. typedef struct FT_Raster_Funcs_
  3578. {
  3579. FT_Glyph_Format glyph_format;
  3580. FT_Raster_NewFunc raster_new;
  3581. FT_Raster_ResetFunc raster_reset;
  3582. FT_Raster_SetModeFunc raster_set_mode;
  3583. FT_Raster_RenderFunc raster_render;
  3584. FT_Raster_DoneFunc raster_done;
  3585. } FT_Raster_Funcs;
  3586. /* */
  3587. FT_END_HEADER
  3588. #endif /* __FTIMAGE_H__ */
  3589. /* END */
  3590. /* Local Variables: */
  3591. /* coding: utf-8 */
  3592. /* End: */
  3593. /*** End of inlined file: ftimage.h ***/
  3594. #include <stddef.h>
  3595. FT_BEGIN_HEADER
  3596. /*************************************************************************/
  3597. /* */
  3598. /* <Section> */
  3599. /* basic_types */
  3600. /* */
  3601. /* <Title> */
  3602. /* Basic Data Types */
  3603. /* */
  3604. /* <Abstract> */
  3605. /* The basic data types defined by the library. */
  3606. /* */
  3607. /* <Description> */
  3608. /* This section contains the basic data types defined by FreeType~2, */
  3609. /* ranging from simple scalar types to bitmap descriptors. More */
  3610. /* font-specific structures are defined in a different section. */
  3611. /* */
  3612. /* <Order> */
  3613. /* FT_Byte */
  3614. /* FT_Bytes */
  3615. /* FT_Char */
  3616. /* FT_Int */
  3617. /* FT_UInt */
  3618. /* FT_Int16 */
  3619. /* FT_UInt16 */
  3620. /* FT_Int32 */
  3621. /* FT_UInt32 */
  3622. /* FT_Short */
  3623. /* FT_UShort */
  3624. /* FT_Long */
  3625. /* FT_ULong */
  3626. /* FT_Bool */
  3627. /* FT_Offset */
  3628. /* FT_PtrDist */
  3629. /* FT_String */
  3630. /* FT_Tag */
  3631. /* FT_Error */
  3632. /* FT_Fixed */
  3633. /* FT_Pointer */
  3634. /* FT_Pos */
  3635. /* FT_Vector */
  3636. /* FT_BBox */
  3637. /* FT_Matrix */
  3638. /* FT_FWord */
  3639. /* FT_UFWord */
  3640. /* FT_F2Dot14 */
  3641. /* FT_UnitVector */
  3642. /* FT_F26Dot6 */
  3643. /* */
  3644. /* */
  3645. /* FT_Generic */
  3646. /* FT_Generic_Finalizer */
  3647. /* */
  3648. /* FT_Bitmap */
  3649. /* FT_Pixel_Mode */
  3650. /* FT_Palette_Mode */
  3651. /* FT_Glyph_Format */
  3652. /* FT_IMAGE_TAG */
  3653. /* */
  3654. /*************************************************************************/
  3655. /*************************************************************************/
  3656. /* */
  3657. /* <Type> */
  3658. /* FT_Bool */
  3659. /* */
  3660. /* <Description> */
  3661. /* A typedef of unsigned char, used for simple booleans. As usual, */
  3662. /* values 1 and~0 represent true and false, respectively. */
  3663. /* */
  3664. typedef unsigned char FT_Bool;
  3665. /*************************************************************************/
  3666. /* */
  3667. /* <Type> */
  3668. /* FT_FWord */
  3669. /* */
  3670. /* <Description> */
  3671. /* A signed 16-bit integer used to store a distance in original font */
  3672. /* units. */
  3673. /* */
  3674. typedef signed short FT_FWord; /* distance in FUnits */
  3675. /*************************************************************************/
  3676. /* */
  3677. /* <Type> */
  3678. /* FT_UFWord */
  3679. /* */
  3680. /* <Description> */
  3681. /* An unsigned 16-bit integer used to store a distance in original */
  3682. /* font units. */
  3683. /* */
  3684. typedef unsigned short FT_UFWord; /* unsigned distance */
  3685. /*************************************************************************/
  3686. /* */
  3687. /* <Type> */
  3688. /* FT_Char */
  3689. /* */
  3690. /* <Description> */
  3691. /* A simple typedef for the _signed_ char type. */
  3692. /* */
  3693. typedef signed char FT_Char;
  3694. /*************************************************************************/
  3695. /* */
  3696. /* <Type> */
  3697. /* FT_Byte */
  3698. /* */
  3699. /* <Description> */
  3700. /* A simple typedef for the _unsigned_ char type. */
  3701. /* */
  3702. typedef unsigned char FT_Byte;
  3703. /*************************************************************************/
  3704. /* */
  3705. /* <Type> */
  3706. /* FT_Bytes */
  3707. /* */
  3708. /* <Description> */
  3709. /* A typedef for constant memory areas. */
  3710. /* */
  3711. typedef const FT_Byte* FT_Bytes;
  3712. /*************************************************************************/
  3713. /* */
  3714. /* <Type> */
  3715. /* FT_Tag */
  3716. /* */
  3717. /* <Description> */
  3718. /* A typedef for 32-bit tags (as used in the SFNT format). */
  3719. /* */
  3720. typedef FT_UInt32 FT_Tag;
  3721. /*************************************************************************/
  3722. /* */
  3723. /* <Type> */
  3724. /* FT_String */
  3725. /* */
  3726. /* <Description> */
  3727. /* A simple typedef for the char type, usually used for strings. */
  3728. /* */
  3729. typedef char FT_String;
  3730. /*************************************************************************/
  3731. /* */
  3732. /* <Type> */
  3733. /* FT_Short */
  3734. /* */
  3735. /* <Description> */
  3736. /* A typedef for signed short. */
  3737. /* */
  3738. typedef signed short FT_Short;
  3739. /*************************************************************************/
  3740. /* */
  3741. /* <Type> */
  3742. /* FT_UShort */
  3743. /* */
  3744. /* <Description> */
  3745. /* A typedef for unsigned short. */
  3746. /* */
  3747. typedef unsigned short FT_UShort;
  3748. /*************************************************************************/
  3749. /* */
  3750. /* <Type> */
  3751. /* FT_Int */
  3752. /* */
  3753. /* <Description> */
  3754. /* A typedef for the int type. */
  3755. /* */
  3756. typedef signed int FT_Int;
  3757. /*************************************************************************/
  3758. /* */
  3759. /* <Type> */
  3760. /* FT_UInt */
  3761. /* */
  3762. /* <Description> */
  3763. /* A typedef for the unsigned int type. */
  3764. /* */
  3765. typedef unsigned int FT_UInt;
  3766. /*************************************************************************/
  3767. /* */
  3768. /* <Type> */
  3769. /* FT_Long */
  3770. /* */
  3771. /* <Description> */
  3772. /* A typedef for signed long. */
  3773. /* */
  3774. typedef signed long FT_Long;
  3775. /*************************************************************************/
  3776. /* */
  3777. /* <Type> */
  3778. /* FT_ULong */
  3779. /* */
  3780. /* <Description> */
  3781. /* A typedef for unsigned long. */
  3782. /* */
  3783. typedef unsigned long FT_ULong;
  3784. /*************************************************************************/
  3785. /* */
  3786. /* <Type> */
  3787. /* FT_F2Dot14 */
  3788. /* */
  3789. /* <Description> */
  3790. /* A signed 2.14 fixed-point type used for unit vectors. */
  3791. /* */
  3792. typedef signed short FT_F2Dot14;
  3793. /*************************************************************************/
  3794. /* */
  3795. /* <Type> */
  3796. /* FT_F26Dot6 */
  3797. /* */
  3798. /* <Description> */
  3799. /* A signed 26.6 fixed-point type used for vectorial pixel */
  3800. /* coordinates. */
  3801. /* */
  3802. typedef signed long FT_F26Dot6;
  3803. /*************************************************************************/
  3804. /* */
  3805. /* <Type> */
  3806. /* FT_Fixed */
  3807. /* */
  3808. /* <Description> */
  3809. /* This type is used to store 16.16 fixed-point values, like scaling */
  3810. /* values or matrix coefficients. */
  3811. /* */
  3812. typedef signed long FT_Fixed;
  3813. /*************************************************************************/
  3814. /* */
  3815. /* <Type> */
  3816. /* FT_Error */
  3817. /* */
  3818. /* <Description> */
  3819. /* The FreeType error code type. A value of~0 is always interpreted */
  3820. /* as a successful operation. */
  3821. /* */
  3822. typedef int FT_Error;
  3823. /*************************************************************************/
  3824. /* */
  3825. /* <Type> */
  3826. /* FT_Pointer */
  3827. /* */
  3828. /* <Description> */
  3829. /* A simple typedef for a typeless pointer. */
  3830. /* */
  3831. typedef void* FT_Pointer;
  3832. /*************************************************************************/
  3833. /* */
  3834. /* <Type> */
  3835. /* FT_Offset */
  3836. /* */
  3837. /* <Description> */
  3838. /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
  3839. /* _unsigned_ integer type used to express a file size or position, */
  3840. /* or a memory block size. */
  3841. /* */
  3842. typedef size_t FT_Offset;
  3843. /*************************************************************************/
  3844. /* */
  3845. /* <Type> */
  3846. /* FT_PtrDist */
  3847. /* */
  3848. /* <Description> */
  3849. /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
  3850. /* largest _signed_ integer type used to express the distance */
  3851. /* between two pointers. */
  3852. /* */
  3853. typedef ft_ptrdiff_t FT_PtrDist;
  3854. /*************************************************************************/
  3855. /* */
  3856. /* <Struct> */
  3857. /* FT_UnitVector */
  3858. /* */
  3859. /* <Description> */
  3860. /* A simple structure used to store a 2D vector unit vector. Uses */
  3861. /* FT_F2Dot14 types. */
  3862. /* */
  3863. /* <Fields> */
  3864. /* x :: Horizontal coordinate. */
  3865. /* */
  3866. /* y :: Vertical coordinate. */
  3867. /* */
  3868. typedef struct FT_UnitVector_
  3869. {
  3870. FT_F2Dot14 x;
  3871. FT_F2Dot14 y;
  3872. } FT_UnitVector;
  3873. /*************************************************************************/
  3874. /* */
  3875. /* <Struct> */
  3876. /* FT_Matrix */
  3877. /* */
  3878. /* <Description> */
  3879. /* A simple structure used to store a 2x2 matrix. Coefficients are */
  3880. /* in 16.16 fixed-point format. The computation performed is: */
  3881. /* */
  3882. /* { */
  3883. /* x' = x*xx + y*xy */
  3884. /* y' = x*yx + y*yy */
  3885. /* } */
  3886. /* */
  3887. /* <Fields> */
  3888. /* xx :: Matrix coefficient. */
  3889. /* */
  3890. /* xy :: Matrix coefficient. */
  3891. /* */
  3892. /* yx :: Matrix coefficient. */
  3893. /* */
  3894. /* yy :: Matrix coefficient. */
  3895. /* */
  3896. typedef struct FT_Matrix_
  3897. {
  3898. FT_Fixed xx, xy;
  3899. FT_Fixed yx, yy;
  3900. } FT_Matrix;
  3901. /*************************************************************************/
  3902. /* */
  3903. /* <Struct> */
  3904. /* FT_Data */
  3905. /* */
  3906. /* <Description> */
  3907. /* Read-only binary data represented as a pointer and a length. */
  3908. /* */
  3909. /* <Fields> */
  3910. /* pointer :: The data. */
  3911. /* */
  3912. /* length :: The length of the data in bytes. */
  3913. /* */
  3914. typedef struct FT_Data_
  3915. {
  3916. const FT_Byte* pointer;
  3917. FT_Int length;
  3918. } FT_Data;
  3919. /*************************************************************************/
  3920. /* */
  3921. /* <FuncType> */
  3922. /* FT_Generic_Finalizer */
  3923. /* */
  3924. /* <Description> */
  3925. /* Describe a function used to destroy the `client' data of any */
  3926. /* FreeType object. See the description of the @FT_Generic type for */
  3927. /* details of usage. */
  3928. /* */
  3929. /* <Input> */
  3930. /* The address of the FreeType object which is under finalization. */
  3931. /* Its client data is accessed through its `generic' field. */
  3932. /* */
  3933. typedef void (*FT_Generic_Finalizer)(void* object);
  3934. /*************************************************************************/
  3935. /* */
  3936. /* <Struct> */
  3937. /* FT_Generic */
  3938. /* */
  3939. /* <Description> */
  3940. /* Client applications often need to associate their own data to a */
  3941. /* variety of FreeType core objects. For example, a text layout API */
  3942. /* might want to associate a glyph cache to a given size object. */
  3943. /* */
  3944. /* Some FreeType object contains a `generic' field, of type */
  3945. /* FT_Generic, which usage is left to client applications and font */
  3946. /* servers. */
  3947. /* */
  3948. /* It can be used to store a pointer to client-specific data, as well */
  3949. /* as the address of a `finalizer' function, which will be called by */
  3950. /* FreeType when the object is destroyed (for example, the previous */
  3951. /* client example would put the address of the glyph cache destructor */
  3952. /* in the `finalizer' field). */
  3953. /* */
  3954. /* <Fields> */
  3955. /* data :: A typeless pointer to any client-specified data. This */
  3956. /* field is completely ignored by the FreeType library. */
  3957. /* */
  3958. /* finalizer :: A pointer to a `generic finalizer' function, which */
  3959. /* will be called when the object is destroyed. If this */
  3960. /* field is set to NULL, no code will be called. */
  3961. /* */
  3962. typedef struct FT_Generic_
  3963. {
  3964. void* data;
  3965. FT_Generic_Finalizer finalizer;
  3966. } FT_Generic;
  3967. /*************************************************************************/
  3968. /* */
  3969. /* <Macro> */
  3970. /* FT_MAKE_TAG */
  3971. /* */
  3972. /* <Description> */
  3973. /* This macro converts four-letter tags which are used to label */
  3974. /* TrueType tables into an unsigned long to be used within FreeType. */
  3975. /* */
  3976. /* <Note> */
  3977. /* The produced values *must* be 32-bit integers. Don't redefine */
  3978. /* this macro. */
  3979. /* */
  3980. #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
  3981. (FT_Tag) \
  3982. ( ( (FT_ULong)_x1 << 24 ) | \
  3983. ( (FT_ULong)_x2 << 16 ) | \
  3984. ( (FT_ULong)_x3 << 8 ) | \
  3985. (FT_ULong)_x4 )
  3986. /*************************************************************************/
  3987. /*************************************************************************/
  3988. /* */
  3989. /* L I S T M A N A G E M E N T */
  3990. /* */
  3991. /*************************************************************************/
  3992. /*************************************************************************/
  3993. /*************************************************************************/
  3994. /* */
  3995. /* <Section> */
  3996. /* list_processing */
  3997. /* */
  3998. /*************************************************************************/
  3999. /*************************************************************************/
  4000. /* */
  4001. /* <Type> */
  4002. /* FT_ListNode */
  4003. /* */
  4004. /* <Description> */
  4005. /* Many elements and objects in FreeType are listed through an */
  4006. /* @FT_List record (see @FT_ListRec). As its name suggests, an */
  4007. /* FT_ListNode is a handle to a single list element. */
  4008. /* */
  4009. typedef struct FT_ListNodeRec_* FT_ListNode;
  4010. /*************************************************************************/
  4011. /* */
  4012. /* <Type> */
  4013. /* FT_List */
  4014. /* */
  4015. /* <Description> */
  4016. /* A handle to a list record (see @FT_ListRec). */
  4017. /* */
  4018. typedef struct FT_ListRec_* FT_List;
  4019. /*************************************************************************/
  4020. /* */
  4021. /* <Struct> */
  4022. /* FT_ListNodeRec */
  4023. /* */
  4024. /* <Description> */
  4025. /* A structure used to hold a single list element. */
  4026. /* */
  4027. /* <Fields> */
  4028. /* prev :: The previous element in the list. NULL if first. */
  4029. /* */
  4030. /* next :: The next element in the list. NULL if last. */
  4031. /* */
  4032. /* data :: A typeless pointer to the listed object. */
  4033. /* */
  4034. typedef struct FT_ListNodeRec_
  4035. {
  4036. FT_ListNode prev;
  4037. FT_ListNode next;
  4038. void* data;
  4039. } FT_ListNodeRec;
  4040. /*************************************************************************/
  4041. /* */
  4042. /* <Struct> */
  4043. /* FT_ListRec */
  4044. /* */
  4045. /* <Description> */
  4046. /* A structure used to hold a simple doubly-linked list. These are */
  4047. /* used in many parts of FreeType. */
  4048. /* */
  4049. /* <Fields> */
  4050. /* head :: The head (first element) of doubly-linked list. */
  4051. /* */
  4052. /* tail :: The tail (last element) of doubly-linked list. */
  4053. /* */
  4054. typedef struct FT_ListRec_
  4055. {
  4056. FT_ListNode head;
  4057. FT_ListNode tail;
  4058. } FT_ListRec;
  4059. /* */
  4060. #define FT_IS_EMPTY( list ) ( (list).head == 0 )
  4061. #define FT_BOOL( x ) ( (FT_Bool)( x ) )
  4062. /* concatenate C tokens */
  4063. #define FT_ERR_XCAT( x, y ) x ## y
  4064. #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
  4065. /* see `ftmoderr.h' for descriptions of the following macros */
  4066. #define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
  4067. #define FT_ERROR_BASE( x ) ( (x) & 0xFF )
  4068. #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
  4069. #define FT_ERR_EQ( x, e ) \
  4070. ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )
  4071. #define FT_ERR_NEQ( x, e ) \
  4072. ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )
  4073. FT_END_HEADER
  4074. #endif /* __FTTYPES_H__ */
  4075. /* END */
  4076. /*** End of inlined file: fttypes.h ***/
  4077. /*** Start of inlined file: fterrors.h ***/
  4078. /* */
  4079. /* fterrors.h */
  4080. /* */
  4081. /* FreeType error code handling (specification). */
  4082. /* */
  4083. /* Copyright 1996-2002, 2004, 2007, 2013 by */
  4084. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  4085. /* */
  4086. /* This file is part of the FreeType project, and may only be used, */
  4087. /* modified, and distributed under the terms of the FreeType project */
  4088. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  4089. /* this file you indicate that you have read the license and */
  4090. /* understand and accept it fully. */
  4091. /* */
  4092. /***************************************************************************/
  4093. /*************************************************************************/
  4094. /* */
  4095. /* This special header file is used to define the handling of FT2 */
  4096. /* enumeration constants. It can also be used to generate error message */
  4097. /* strings with a small macro trick explained below. */
  4098. /* */
  4099. /* I - Error Formats */
  4100. /* ----------------- */
  4101. /* */
  4102. /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
  4103. /* defined in ftoption.h in order to make the higher byte indicate */
  4104. /* the module where the error has happened (this is not compatible */
  4105. /* with standard builds of FreeType 2). See the file `ftmoderr.h' for */
  4106. /* more details. */
  4107. /* */
  4108. /* */
  4109. /* II - Error Message strings */
  4110. /* -------------------------- */
  4111. /* */
  4112. /* The error definitions below are made through special macros that */
  4113. /* allow client applications to build a table of error message strings */
  4114. /* if they need it. The strings are not included in a normal build of */
  4115. /* FreeType 2 to save space (most client applications do not use */
  4116. /* them). */
  4117. /* */
  4118. /* To do so, you have to define the following macros before including */
  4119. /* this file: */
  4120. /* */
  4121. /* FT_ERROR_START_LIST :: */
  4122. /* This macro is called before anything else to define the start of */
  4123. /* the error list. It is followed by several FT_ERROR_DEF calls */
  4124. /* (see below). */
  4125. /* */
  4126. /* FT_ERROR_DEF( e, v, s ) :: */
  4127. /* This macro is called to define one single error. */
  4128. /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */
  4129. /* `v' is the error numerical value. */
  4130. /* `s' is the corresponding error string. */
  4131. /* */
  4132. /* FT_ERROR_END_LIST :: */
  4133. /* This macro ends the list. */
  4134. /* */
  4135. /* Additionally, you have to undefine __FTERRORS_H__ before #including */
  4136. /* this file. */
  4137. /* */
  4138. /* Here is a simple example: */
  4139. /* */
  4140. /* { */
  4141. /* #undef __FTERRORS_H__ */
  4142. /* #define FT_ERRORDEF( e, v, s ) { e, s }, */
  4143. /* #define FT_ERROR_START_LIST { */
  4144. /* #define FT_ERROR_END_LIST { 0, 0 } }; */
  4145. /* */
  4146. /* const struct */
  4147. /* { */
  4148. /* int err_code; */
  4149. /* const char* err_msg; */
  4150. /* } ft_errors[] = */
  4151. /* */
  4152. /* #include FT_ERRORS_H */
  4153. /* } */
  4154. /* */
  4155. /*************************************************************************/
  4156. #ifndef __FTERRORS_H__
  4157. #define __FTERRORS_H__
  4158. /* include module base error codes */
  4159. /*** Start of inlined file: ftmoderr.h ***/
  4160. /* */
  4161. /* ftmoderr.h */
  4162. /* */
  4163. /* FreeType module error offsets (specification). */
  4164. /* */
  4165. /* Copyright 2001-2005, 2010, 2013 by */
  4166. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  4167. /* */
  4168. /* This file is part of the FreeType project, and may only be used, */
  4169. /* modified, and distributed under the terms of the FreeType project */
  4170. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  4171. /* this file you indicate that you have read the license and */
  4172. /* understand and accept it fully. */
  4173. /* */
  4174. /***************************************************************************/
  4175. /*************************************************************************/
  4176. /* */
  4177. /* This file is used to define the FreeType module error codes. */
  4178. /* */
  4179. /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */
  4180. /* set, the lower byte of an error value identifies the error code as */
  4181. /* usual. In addition, the higher byte identifies the module. For */
  4182. /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */
  4183. /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */
  4184. /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */
  4185. /* */
  4186. /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */
  4187. /* including the high byte. */
  4188. /* */
  4189. /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */
  4190. /* an error value is set to zero. */
  4191. /* */
  4192. /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */
  4193. /* provides some macros in `fttypes.h'. */
  4194. /* */
  4195. /* FT_ERR( err ) */
  4196. /* Add current error module prefix (as defined with the */
  4197. /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */
  4198. /* the line */
  4199. /* */
  4200. /* error = FT_ERR( Invalid_Outline ); */
  4201. /* */
  4202. /* expands to */
  4203. /* */
  4204. /* error = BDF_Err_Invalid_Outline; */
  4205. /* */
  4206. /* For simplicity, you can always use `FT_Err_Ok' directly instead */
  4207. /* of `FT_ERR( Ok )'. */
  4208. /* */
  4209. /* FT_ERR_EQ( errcode, err ) */
  4210. /* FT_ERR_NEQ( errcode, err ) */
  4211. /* Compare error code `errcode' with the error `err' for equality */
  4212. /* and inequality, respectively. Example: */
  4213. /* */
  4214. /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */
  4215. /* ... */
  4216. /* */
  4217. /* Using this macro you don't have to think about error prefixes. */
  4218. /* Of course, if module errors are not active, the above example is */
  4219. /* the same as */
  4220. /* */
  4221. /* if ( error == FT_Err_Invalid_Outline ) */
  4222. /* ... */
  4223. /* */
  4224. /* FT_ERROR_BASE( errcode ) */
  4225. /* FT_ERROR_MODULE( errcode ) */
  4226. /* Get base error and module error code, respectively. */
  4227. /* */
  4228. /* */
  4229. /* It can also be used to create a module error message table easily */
  4230. /* with something like */
  4231. /* */
  4232. /* { */
  4233. /* #undef __FTMODERR_H__ */
  4234. /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */
  4235. /* #define FT_MODERR_START_LIST { */
  4236. /* #define FT_MODERR_END_LIST { 0, 0 } }; */
  4237. /* */
  4238. /* const struct */
  4239. /* { */
  4240. /* int mod_err_offset; */
  4241. /* const char* mod_err_msg */
  4242. /* } ft_mod_errors[] = */
  4243. /* */
  4244. /* #include FT_MODULE_ERRORS_H */
  4245. /* } */
  4246. /* */
  4247. /*************************************************************************/
  4248. #ifndef __FTMODERR_H__
  4249. #define __FTMODERR_H__
  4250. /*******************************************************************/
  4251. /*******************************************************************/
  4252. /***** *****/
  4253. /***** SETUP MACROS *****/
  4254. /***** *****/
  4255. /*******************************************************************/
  4256. /*******************************************************************/
  4257. #undef FT_NEED_EXTERN_C
  4258. #ifndef FT_MODERRDEF
  4259. #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
  4260. #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
  4261. #else
  4262. #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
  4263. #endif
  4264. #define FT_MODERR_START_LIST enum {
  4265. #define FT_MODERR_END_LIST FT_Mod_Err_Max };
  4266. #ifdef __cplusplus
  4267. #define FT_NEED_EXTERN_C
  4268. extern "C" {
  4269. #endif
  4270. #endif /* !FT_MODERRDEF */
  4271. /*******************************************************************/
  4272. /*******************************************************************/
  4273. /***** *****/
  4274. /***** LIST MODULE ERROR BASES *****/
  4275. /***** *****/
  4276. /*******************************************************************/
  4277. /*******************************************************************/
  4278. #ifdef FT_MODERR_START_LIST
  4279. FT_MODERR_START_LIST
  4280. #endif
  4281. FT_MODERRDEF( Base, 0x000, "base module" )
  4282. FT_MODERRDEF( Autofit, 0x100, "autofitter module" )
  4283. FT_MODERRDEF( BDF, 0x200, "BDF module" )
  4284. FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" )
  4285. FT_MODERRDEF( Cache, 0x400, "cache module" )
  4286. FT_MODERRDEF( CFF, 0x500, "CFF module" )
  4287. FT_MODERRDEF( CID, 0x600, "CID module" )
  4288. FT_MODERRDEF( Gzip, 0x700, "Gzip module" )
  4289. FT_MODERRDEF( LZW, 0x800, "LZW module" )
  4290. FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" )
  4291. FT_MODERRDEF( PCF, 0xA00, "PCF module" )
  4292. FT_MODERRDEF( PFR, 0xB00, "PFR module" )
  4293. FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" )
  4294. FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" )
  4295. FT_MODERRDEF( PSnames, 0xE00, "PS names module" )
  4296. FT_MODERRDEF( Raster, 0xF00, "raster module" )
  4297. FT_MODERRDEF( SFNT, 0x1000, "SFNT module" )
  4298. FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" )
  4299. FT_MODERRDEF( TrueType, 0x1200, "TrueType module" )
  4300. FT_MODERRDEF( Type1, 0x1300, "Type 1 module" )
  4301. FT_MODERRDEF( Type42, 0x1400, "Type 42 module" )
  4302. FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
  4303. FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
  4304. #ifdef FT_MODERR_END_LIST
  4305. FT_MODERR_END_LIST
  4306. #endif
  4307. /*******************************************************************/
  4308. /*******************************************************************/
  4309. /***** *****/
  4310. /***** CLEANUP *****/
  4311. /***** *****/
  4312. /*******************************************************************/
  4313. /*******************************************************************/
  4314. #ifdef FT_NEED_EXTERN_C
  4315. }
  4316. #endif
  4317. #undef FT_MODERR_START_LIST
  4318. #undef FT_MODERR_END_LIST
  4319. #undef FT_MODERRDEF
  4320. #undef FT_NEED_EXTERN_C
  4321. #endif /* __FTMODERR_H__ */
  4322. /* END */
  4323. /*** End of inlined file: ftmoderr.h ***/
  4324. /*******************************************************************/
  4325. /*******************************************************************/
  4326. /***** *****/
  4327. /***** SETUP MACROS *****/
  4328. /***** *****/
  4329. /*******************************************************************/
  4330. /*******************************************************************/
  4331. #undef FT_NEED_EXTERN_C
  4332. /* FT_ERR_PREFIX is used as a prefix for error identifiers. */
  4333. /* By default, we use `FT_Err_'. */
  4334. /* */
  4335. #ifndef FT_ERR_PREFIX
  4336. #define FT_ERR_PREFIX FT_Err_
  4337. #endif
  4338. /* FT_ERR_BASE is used as the base for module-specific errors. */
  4339. /* */
  4340. #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
  4341. #ifndef FT_ERR_BASE
  4342. #define FT_ERR_BASE FT_Mod_Err_Base
  4343. #endif
  4344. #else
  4345. #undef FT_ERR_BASE
  4346. #define FT_ERR_BASE 0
  4347. #endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
  4348. /* If FT_ERRORDEF is not defined, we need to define a simple */
  4349. /* enumeration type. */
  4350. /* */
  4351. #ifndef FT_ERRORDEF
  4352. #define FT_ERRORDEF( e, v, s ) e = v,
  4353. #define FT_ERROR_START_LIST enum {
  4354. #define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
  4355. #ifdef __cplusplus
  4356. #define FT_NEED_EXTERN_C
  4357. extern "C" {
  4358. #endif
  4359. #endif /* !FT_ERRORDEF */
  4360. /* this macro is used to define an error */
  4361. #define FT_ERRORDEF_( e, v, s ) \
  4362. FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
  4363. /* this is only used for <module>_Err_Ok, which must be 0! */
  4364. #define FT_NOERRORDEF_( e, v, s ) \
  4365. FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
  4366. #ifdef FT_ERROR_START_LIST
  4367. FT_ERROR_START_LIST
  4368. #endif
  4369. /* now include the error codes */
  4370. /*** Start of inlined file: fterrdef.h ***/
  4371. /* */
  4372. /* fterrdef.h */
  4373. /* */
  4374. /* FreeType error codes (specification). */
  4375. /* */
  4376. /* Copyright 2002, 2004, 2006, 2007, 2010-2013 by */
  4377. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  4378. /* */
  4379. /* This file is part of the FreeType project, and may only be used, */
  4380. /* modified, and distributed under the terms of the FreeType project */
  4381. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  4382. /* this file you indicate that you have read the license and */
  4383. /* understand and accept it fully. */
  4384. /* */
  4385. /***************************************************************************/
  4386. /*******************************************************************/
  4387. /*******************************************************************/
  4388. /***** *****/
  4389. /***** LIST OF ERROR CODES/MESSAGES *****/
  4390. /***** *****/
  4391. /*******************************************************************/
  4392. /*******************************************************************/
  4393. /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */
  4394. /* including this file. */
  4395. /* generic errors */
  4396. FT_NOERRORDEF_( Ok, 0x00, \
  4397. "no error" )
  4398. FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \
  4399. "cannot open resource" )
  4400. FT_ERRORDEF_( Unknown_File_Format, 0x02, \
  4401. "unknown file format" )
  4402. FT_ERRORDEF_( Invalid_File_Format, 0x03, \
  4403. "broken file" )
  4404. FT_ERRORDEF_( Invalid_Version, 0x04, \
  4405. "invalid FreeType version" )
  4406. FT_ERRORDEF_( Lower_Module_Version, 0x05, \
  4407. "module version is too low" )
  4408. FT_ERRORDEF_( Invalid_Argument, 0x06, \
  4409. "invalid argument" )
  4410. FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
  4411. "unimplemented feature" )
  4412. FT_ERRORDEF_( Invalid_Table, 0x08, \
  4413. "broken table" )
  4414. FT_ERRORDEF_( Invalid_Offset, 0x09, \
  4415. "broken offset within table" )
  4416. FT_ERRORDEF_( Array_Too_Large, 0x0A, \
  4417. "array allocation size too large" )
  4418. FT_ERRORDEF_( Missing_Module, 0x0B, \
  4419. "missing module" )
  4420. FT_ERRORDEF_( Missing_Property, 0x0C, \
  4421. "missing property" )
  4422. /* glyph/character errors */
  4423. FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \
  4424. "invalid glyph index" )
  4425. FT_ERRORDEF_( Invalid_Character_Code, 0x11, \
  4426. "invalid character code" )
  4427. FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \
  4428. "unsupported glyph image format" )
  4429. FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \
  4430. "cannot render this glyph format" )
  4431. FT_ERRORDEF_( Invalid_Outline, 0x14, \
  4432. "invalid outline" )
  4433. FT_ERRORDEF_( Invalid_Composite, 0x15, \
  4434. "invalid composite glyph" )
  4435. FT_ERRORDEF_( Too_Many_Hints, 0x16, \
  4436. "too many hints" )
  4437. FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \
  4438. "invalid pixel size" )
  4439. /* handle errors */
  4440. FT_ERRORDEF_( Invalid_Handle, 0x20, \
  4441. "invalid object handle" )
  4442. FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \
  4443. "invalid library handle" )
  4444. FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \
  4445. "invalid module handle" )
  4446. FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \
  4447. "invalid face handle" )
  4448. FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \
  4449. "invalid size handle" )
  4450. FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \
  4451. "invalid glyph slot handle" )
  4452. FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \
  4453. "invalid charmap handle" )
  4454. FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \
  4455. "invalid cache manager handle" )
  4456. FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \
  4457. "invalid stream handle" )
  4458. /* driver errors */
  4459. FT_ERRORDEF_( Too_Many_Drivers, 0x30, \
  4460. "too many modules" )
  4461. FT_ERRORDEF_( Too_Many_Extensions, 0x31, \
  4462. "too many extensions" )
  4463. /* memory errors */
  4464. FT_ERRORDEF_( Out_Of_Memory, 0x40, \
  4465. "out of memory" )
  4466. FT_ERRORDEF_( Unlisted_Object, 0x41, \
  4467. "unlisted object" )
  4468. /* stream errors */
  4469. FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \
  4470. "cannot open stream" )
  4471. FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \
  4472. "invalid stream seek" )
  4473. FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \
  4474. "invalid stream skip" )
  4475. FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \
  4476. "invalid stream read" )
  4477. FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \
  4478. "invalid stream operation" )
  4479. FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \
  4480. "invalid frame operation" )
  4481. FT_ERRORDEF_( Nested_Frame_Access, 0x57, \
  4482. "nested frame access" )
  4483. FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \
  4484. "invalid frame read" )
  4485. /* raster errors */
  4486. FT_ERRORDEF_( Raster_Uninitialized, 0x60, \
  4487. "raster uninitialized" )
  4488. FT_ERRORDEF_( Raster_Corrupted, 0x61, \
  4489. "raster corrupted" )
  4490. FT_ERRORDEF_( Raster_Overflow, 0x62, \
  4491. "raster overflow" )
  4492. FT_ERRORDEF_( Raster_Negative_Height, 0x63, \
  4493. "negative height while rastering" )
  4494. /* cache errors */
  4495. FT_ERRORDEF_( Too_Many_Caches, 0x70, \
  4496. "too many registered caches" )
  4497. /* TrueType and SFNT errors */
  4498. FT_ERRORDEF_( Invalid_Opcode, 0x80, \
  4499. "invalid opcode" )
  4500. FT_ERRORDEF_( Too_Few_Arguments, 0x81, \
  4501. "too few arguments" )
  4502. FT_ERRORDEF_( Stack_Overflow, 0x82, \
  4503. "stack overflow" )
  4504. FT_ERRORDEF_( Code_Overflow, 0x83, \
  4505. "code overflow" )
  4506. FT_ERRORDEF_( Bad_Argument, 0x84, \
  4507. "bad argument" )
  4508. FT_ERRORDEF_( Divide_By_Zero, 0x85, \
  4509. "division by zero" )
  4510. FT_ERRORDEF_( Invalid_Reference, 0x86, \
  4511. "invalid reference" )
  4512. FT_ERRORDEF_( Debug_OpCode, 0x87, \
  4513. "found debug opcode" )
  4514. FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \
  4515. "found ENDF opcode in execution stream" )
  4516. FT_ERRORDEF_( Nested_DEFS, 0x89, \
  4517. "nested DEFS" )
  4518. FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \
  4519. "invalid code range" )
  4520. FT_ERRORDEF_( Execution_Too_Long, 0x8B, \
  4521. "execution context too long" )
  4522. FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \
  4523. "too many function definitions" )
  4524. FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \
  4525. "too many instruction definitions" )
  4526. FT_ERRORDEF_( Table_Missing, 0x8E, \
  4527. "SFNT font table missing" )
  4528. FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \
  4529. "horizontal header (hhea) table missing" )
  4530. FT_ERRORDEF_( Locations_Missing, 0x90, \
  4531. "locations (loca) table missing" )
  4532. FT_ERRORDEF_( Name_Table_Missing, 0x91, \
  4533. "name table missing" )
  4534. FT_ERRORDEF_( CMap_Table_Missing, 0x92, \
  4535. "character map (cmap) table missing" )
  4536. FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \
  4537. "horizontal metrics (hmtx) table missing" )
  4538. FT_ERRORDEF_( Post_Table_Missing, 0x94, \
  4539. "PostScript (post) table missing" )
  4540. FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \
  4541. "invalid horizontal metrics" )
  4542. FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \
  4543. "invalid character map (cmap) format" )
  4544. FT_ERRORDEF_( Invalid_PPem, 0x97, \
  4545. "invalid ppem value" )
  4546. FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \
  4547. "invalid vertical metrics" )
  4548. FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \
  4549. "could not find context" )
  4550. FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \
  4551. "invalid PostScript (post) table format" )
  4552. FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \
  4553. "invalid PostScript (post) table" )
  4554. /* CFF, CID, and Type 1 errors */
  4555. FT_ERRORDEF_( Syntax_Error, 0xA0, \
  4556. "opcode syntax error" )
  4557. FT_ERRORDEF_( Stack_Underflow, 0xA1, \
  4558. "argument stack underflow" )
  4559. FT_ERRORDEF_( Ignore, 0xA2, \
  4560. "ignore" )
  4561. FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \
  4562. "no Unicode glyph name found" )
  4563. FT_ERRORDEF_( Glyph_Too_Big, 0xA4, \
  4564. "glyph to big for hinting" )
  4565. /* BDF errors */
  4566. FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \
  4567. "`STARTFONT' field missing" )
  4568. FT_ERRORDEF_( Missing_Font_Field, 0xB1, \
  4569. "`FONT' field missing" )
  4570. FT_ERRORDEF_( Missing_Size_Field, 0xB2, \
  4571. "`SIZE' field missing" )
  4572. FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, \
  4573. "`FONTBOUNDINGBOX' field missing" )
  4574. FT_ERRORDEF_( Missing_Chars_Field, 0xB4, \
  4575. "`CHARS' field missing" )
  4576. FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, \
  4577. "`STARTCHAR' field missing" )
  4578. FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, \
  4579. "`ENCODING' field missing" )
  4580. FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, \
  4581. "`BBX' field missing" )
  4582. FT_ERRORDEF_( Bbx_Too_Big, 0xB8, \
  4583. "`BBX' too big" )
  4584. FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, \
  4585. "Font header corrupted or missing fields" )
  4586. FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, \
  4587. "Font glyphs corrupted or missing fields" )
  4588. /* END */
  4589. /*** End of inlined file: fterrdef.h ***/
  4590. #ifdef FT_ERROR_END_LIST
  4591. FT_ERROR_END_LIST
  4592. #endif
  4593. /*******************************************************************/
  4594. /*******************************************************************/
  4595. /***** *****/
  4596. /***** SIMPLE CLEANUP *****/
  4597. /***** *****/
  4598. /*******************************************************************/
  4599. /*******************************************************************/
  4600. #ifdef FT_NEED_EXTERN_C
  4601. }
  4602. #endif
  4603. #undef FT_ERROR_START_LIST
  4604. #undef FT_ERROR_END_LIST
  4605. #undef FT_ERRORDEF
  4606. #undef FT_ERRORDEF_
  4607. #undef FT_NOERRORDEF_
  4608. #undef FT_NEED_EXTERN_C
  4609. #undef FT_ERR_BASE
  4610. /* FT_ERR_PREFIX is needed internally */
  4611. #ifndef FT2_BUILD_LIBRARY
  4612. #undef FT_ERR_PREFIX
  4613. #endif
  4614. #endif /* __FTERRORS_H__ */
  4615. /* END */
  4616. /*** End of inlined file: fterrors.h ***/
  4617. FT_BEGIN_HEADER
  4618. /*************************************************************************/
  4619. /* */
  4620. /* <Section> */
  4621. /* user_allocation */
  4622. /* */
  4623. /* <Title> */
  4624. /* User allocation */
  4625. /* */
  4626. /* <Abstract> */
  4627. /* How client applications should allocate FreeType data structures. */
  4628. /* */
  4629. /* <Description> */
  4630. /* FreeType assumes that structures allocated by the user and passed */
  4631. /* as arguments are zeroed out except for the actual data. In other */
  4632. /* words, it is recommended to use `calloc' (or variants of it) */
  4633. /* instead of `malloc' for allocation. */
  4634. /* */
  4635. /*************************************************************************/
  4636. /*************************************************************************/
  4637. /*************************************************************************/
  4638. /* */
  4639. /* B A S I C T Y P E S */
  4640. /* */
  4641. /*************************************************************************/
  4642. /*************************************************************************/
  4643. /*************************************************************************/
  4644. /* */
  4645. /* <Section> */
  4646. /* base_interface */
  4647. /* */
  4648. /* <Title> */
  4649. /* Base Interface */
  4650. /* */
  4651. /* <Abstract> */
  4652. /* The FreeType~2 base font interface. */
  4653. /* */
  4654. /* <Description> */
  4655. /* This section describes the public high-level API of FreeType~2. */
  4656. /* */
  4657. /* <Order> */
  4658. /* FT_Library */
  4659. /* FT_Face */
  4660. /* FT_Size */
  4661. /* FT_GlyphSlot */
  4662. /* FT_CharMap */
  4663. /* FT_Encoding */
  4664. /* */
  4665. /* FT_FaceRec */
  4666. /* */
  4667. /* FT_FACE_FLAG_SCALABLE */
  4668. /* FT_FACE_FLAG_FIXED_SIZES */
  4669. /* FT_FACE_FLAG_FIXED_WIDTH */
  4670. /* FT_FACE_FLAG_HORIZONTAL */
  4671. /* FT_FACE_FLAG_VERTICAL */
  4672. /* FT_FACE_FLAG_SFNT */
  4673. /* FT_FACE_FLAG_KERNING */
  4674. /* FT_FACE_FLAG_MULTIPLE_MASTERS */
  4675. /* FT_FACE_FLAG_GLYPH_NAMES */
  4676. /* FT_FACE_FLAG_EXTERNAL_STREAM */
  4677. /* FT_FACE_FLAG_FAST_GLYPHS */
  4678. /* FT_FACE_FLAG_HINTER */
  4679. /* */
  4680. /* FT_STYLE_FLAG_BOLD */
  4681. /* FT_STYLE_FLAG_ITALIC */
  4682. /* */
  4683. /* FT_SizeRec */
  4684. /* FT_Size_Metrics */
  4685. /* */
  4686. /* FT_GlyphSlotRec */
  4687. /* FT_Glyph_Metrics */
  4688. /* FT_SubGlyph */
  4689. /* */
  4690. /* FT_Bitmap_Size */
  4691. /* */
  4692. /* FT_Init_FreeType */
  4693. /* FT_Done_FreeType */
  4694. /* */
  4695. /* FT_New_Face */
  4696. /* FT_Done_Face */
  4697. /* FT_New_Memory_Face */
  4698. /* FT_Open_Face */
  4699. /* FT_Open_Args */
  4700. /* FT_Parameter */
  4701. /* FT_Attach_File */
  4702. /* FT_Attach_Stream */
  4703. /* */
  4704. /* FT_Set_Char_Size */
  4705. /* FT_Set_Pixel_Sizes */
  4706. /* FT_Request_Size */
  4707. /* FT_Select_Size */
  4708. /* FT_Size_Request_Type */
  4709. /* FT_Size_Request */
  4710. /* FT_Set_Transform */
  4711. /* FT_Load_Glyph */
  4712. /* FT_Get_Char_Index */
  4713. /* FT_Get_Name_Index */
  4714. /* FT_Load_Char */
  4715. /* */
  4716. /* FT_OPEN_MEMORY */
  4717. /* FT_OPEN_STREAM */
  4718. /* FT_OPEN_PATHNAME */
  4719. /* FT_OPEN_DRIVER */
  4720. /* FT_OPEN_PARAMS */
  4721. /* */
  4722. /* FT_LOAD_DEFAULT */
  4723. /* FT_LOAD_RENDER */
  4724. /* FT_LOAD_MONOCHROME */
  4725. /* FT_LOAD_LINEAR_DESIGN */
  4726. /* FT_LOAD_NO_SCALE */
  4727. /* FT_LOAD_NO_HINTING */
  4728. /* FT_LOAD_NO_BITMAP */
  4729. /* FT_LOAD_CROP_BITMAP */
  4730. /* */
  4731. /* FT_LOAD_VERTICAL_LAYOUT */
  4732. /* FT_LOAD_IGNORE_TRANSFORM */
  4733. /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
  4734. /* FT_LOAD_FORCE_AUTOHINT */
  4735. /* FT_LOAD_NO_RECURSE */
  4736. /* FT_LOAD_PEDANTIC */
  4737. /* */
  4738. /* FT_LOAD_TARGET_NORMAL */
  4739. /* FT_LOAD_TARGET_LIGHT */
  4740. /* FT_LOAD_TARGET_MONO */
  4741. /* FT_LOAD_TARGET_LCD */
  4742. /* FT_LOAD_TARGET_LCD_V */
  4743. /* */
  4744. /* FT_Render_Glyph */
  4745. /* FT_Render_Mode */
  4746. /* FT_Get_Kerning */
  4747. /* FT_Kerning_Mode */
  4748. /* FT_Get_Track_Kerning */
  4749. /* FT_Get_Glyph_Name */
  4750. /* FT_Get_Postscript_Name */
  4751. /* */
  4752. /* FT_CharMapRec */
  4753. /* FT_Select_Charmap */
  4754. /* FT_Set_Charmap */
  4755. /* FT_Get_Charmap_Index */
  4756. /* */
  4757. /* FT_FSTYPE_INSTALLABLE_EMBEDDING */
  4758. /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */
  4759. /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */
  4760. /* FT_FSTYPE_EDITABLE_EMBEDDING */
  4761. /* FT_FSTYPE_NO_SUBSETTING */
  4762. /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */
  4763. /* */
  4764. /* FT_Get_FSType_Flags */
  4765. /* */
  4766. /*************************************************************************/
  4767. /*************************************************************************/
  4768. /* */
  4769. /* <Struct> */
  4770. /* FT_Glyph_Metrics */
  4771. /* */
  4772. /* <Description> */
  4773. /* A structure used to model the metrics of a single glyph. The */
  4774. /* values are expressed in 26.6 fractional pixel format; if the flag */
  4775. /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
  4776. /* are expressed in font units instead. */
  4777. /* */
  4778. /* <Fields> */
  4779. /* width :: */
  4780. /* The glyph's width. */
  4781. /* */
  4782. /* height :: */
  4783. /* The glyph's height. */
  4784. /* */
  4785. /* horiBearingX :: */
  4786. /* Left side bearing for horizontal layout. */
  4787. /* */
  4788. /* horiBearingY :: */
  4789. /* Top side bearing for horizontal layout. */
  4790. /* */
  4791. /* horiAdvance :: */
  4792. /* Advance width for horizontal layout. */
  4793. /* */
  4794. /* vertBearingX :: */
  4795. /* Left side bearing for vertical layout. */
  4796. /* */
  4797. /* vertBearingY :: */
  4798. /* Top side bearing for vertical layout. Larger positive values */
  4799. /* mean further below the vertical glyph origin. */
  4800. /* */
  4801. /* vertAdvance :: */
  4802. /* Advance height for vertical layout. Positive values mean the */
  4803. /* glyph has a positive advance downward. */
  4804. /* */
  4805. /* <Note> */
  4806. /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
  4807. /* dimensions of the hinted glyph (in case hinting is applicable). */
  4808. /* */
  4809. /* Stroking a glyph with an outside border does not increase */
  4810. /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
  4811. /* values to account for the added width and height. */
  4812. /* */
  4813. typedef struct FT_Glyph_Metrics_
  4814. {
  4815. FT_Pos width;
  4816. FT_Pos height;
  4817. FT_Pos horiBearingX;
  4818. FT_Pos horiBearingY;
  4819. FT_Pos horiAdvance;
  4820. FT_Pos vertBearingX;
  4821. FT_Pos vertBearingY;
  4822. FT_Pos vertAdvance;
  4823. } FT_Glyph_Metrics;
  4824. /*************************************************************************/
  4825. /* */
  4826. /* <Struct> */
  4827. /* FT_Bitmap_Size */
  4828. /* */
  4829. /* <Description> */
  4830. /* This structure models the metrics of a bitmap strike (i.e., a set */
  4831. /* of glyphs for a given point size and resolution) in a bitmap font. */
  4832. /* It is used for the `available_sizes' field of @FT_Face. */
  4833. /* */
  4834. /* <Fields> */
  4835. /* height :: The vertical distance, in pixels, between two */
  4836. /* consecutive baselines. It is always positive. */
  4837. /* */
  4838. /* width :: The average width, in pixels, of all glyphs in the */
  4839. /* strike. */
  4840. /* */
  4841. /* size :: The nominal size of the strike in 26.6 fractional */
  4842. /* points. This field is not very useful. */
  4843. /* */
  4844. /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
  4845. /* pixels. */
  4846. /* */
  4847. /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
  4848. /* pixels. */
  4849. /* */
  4850. /* <Note> */
  4851. /* Windows FNT: */
  4852. /* The nominal size given in a FNT font is not reliable. Thus when */
  4853. /* the driver finds it incorrect, it sets `size' to some calculated */
  4854. /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
  4855. /* height given in the font, respectively. */
  4856. /* */
  4857. /* TrueType embedded bitmaps: */
  4858. /* `size', `width', and `height' values are not contained in the */
  4859. /* bitmap strike itself. They are computed from the global font */
  4860. /* parameters. */
  4861. /* */
  4862. typedef struct FT_Bitmap_Size_
  4863. {
  4864. FT_Short height;
  4865. FT_Short width;
  4866. FT_Pos size;
  4867. FT_Pos x_ppem;
  4868. FT_Pos y_ppem;
  4869. } FT_Bitmap_Size;
  4870. /*************************************************************************/
  4871. /*************************************************************************/
  4872. /* */
  4873. /* O B J E C T C L A S S E S */
  4874. /* */
  4875. /*************************************************************************/
  4876. /*************************************************************************/
  4877. /*************************************************************************/
  4878. /* */
  4879. /* <Type> */
  4880. /* FT_Library */
  4881. /* */
  4882. /* <Description> */
  4883. /* A handle to a FreeType library instance. Each `library' is */
  4884. /* completely independent from the others; it is the `root' of a set */
  4885. /* of objects like fonts, faces, sizes, etc. */
  4886. /* */
  4887. /* It also embeds a memory manager (see @FT_Memory), as well as a */
  4888. /* scan-line converter object (see @FT_Raster). */
  4889. /* */
  4890. /* For multi-threading applications each thread should have its own */
  4891. /* FT_Library object. */
  4892. /* */
  4893. /* <Note> */
  4894. /* Library objects are normally created by @FT_Init_FreeType, and */
  4895. /* destroyed with @FT_Done_FreeType. */
  4896. /* */
  4897. typedef struct FT_LibraryRec_ *FT_Library;
  4898. /*************************************************************************/
  4899. /* */
  4900. /* <Type> */
  4901. /* FT_Module */
  4902. /* */
  4903. /* <Description> */
  4904. /* A handle to a given FreeType module object. Each module can be a */
  4905. /* font driver, a renderer, or anything else that provides services */
  4906. /* to the formers. */
  4907. /* */
  4908. typedef struct FT_ModuleRec_* FT_Module;
  4909. /*************************************************************************/
  4910. /* */
  4911. /* <Type> */
  4912. /* FT_Driver */
  4913. /* */
  4914. /* <Description> */
  4915. /* A handle to a given FreeType font driver object. Each font driver */
  4916. /* is a special module capable of creating faces from font files. */
  4917. /* */
  4918. typedef struct FT_DriverRec_* FT_Driver;
  4919. /*************************************************************************/
  4920. /* */
  4921. /* <Type> */
  4922. /* FT_Renderer */
  4923. /* */
  4924. /* <Description> */
  4925. /* A handle to a given FreeType renderer. A renderer is a special */
  4926. /* module in charge of converting a glyph image to a bitmap, when */
  4927. /* necessary. Each renderer supports a given glyph image format, and */
  4928. /* one or more target surface depths. */
  4929. /* */
  4930. typedef struct FT_RendererRec_* FT_Renderer;
  4931. /*************************************************************************/
  4932. /* */
  4933. /* <Type> */
  4934. /* FT_Face */
  4935. /* */
  4936. /* <Description> */
  4937. /* A handle to a given typographic face object. A face object models */
  4938. /* a given typeface, in a given style. */
  4939. /* */
  4940. /* <Note> */
  4941. /* Each face object also owns a single @FT_GlyphSlot object, as well */
  4942. /* as one or more @FT_Size objects. */
  4943. /* */
  4944. /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
  4945. /* a given filepathname or a custom input stream. */
  4946. /* */
  4947. /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
  4948. /* */
  4949. /* <Also> */
  4950. /* See @FT_FaceRec for the publicly accessible fields of a given face */
  4951. /* object. */
  4952. /* */
  4953. typedef struct FT_FaceRec_* FT_Face;
  4954. /*************************************************************************/
  4955. /* */
  4956. /* <Type> */
  4957. /* FT_Size */
  4958. /* */
  4959. /* <Description> */
  4960. /* A handle to an object used to model a face scaled to a given */
  4961. /* character size. */
  4962. /* */
  4963. /* <Note> */
  4964. /* Each @FT_Face has an _active_ @FT_Size object that is used by */
  4965. /* functions like @FT_Load_Glyph to determine the scaling */
  4966. /* transformation which is used to load and hint glyphs and metrics. */
  4967. /* */
  4968. /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
  4969. /* @FT_Request_Size or even @FT_Select_Size to change the content */
  4970. /* (i.e., the scaling values) of the active @FT_Size. */
  4971. /* */
  4972. /* You can use @FT_New_Size to create additional size objects for a */
  4973. /* given @FT_Face, but they won't be used by other functions until */
  4974. /* you activate it through @FT_Activate_Size. Only one size can be */
  4975. /* activated at any given time per face. */
  4976. /* */
  4977. /* <Also> */
  4978. /* See @FT_SizeRec for the publicly accessible fields of a given size */
  4979. /* object. */
  4980. /* */
  4981. typedef struct FT_SizeRec_* FT_Size;
  4982. /*************************************************************************/
  4983. /* */
  4984. /* <Type> */
  4985. /* FT_GlyphSlot */
  4986. /* */
  4987. /* <Description> */
  4988. /* A handle to a given `glyph slot'. A slot is a container where it */
  4989. /* is possible to load any of the glyphs contained in its parent */
  4990. /* face. */
  4991. /* */
  4992. /* In other words, each time you call @FT_Load_Glyph or */
  4993. /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
  4994. /* i.e., the glyph's metrics, its image (bitmap or outline), and */
  4995. /* other control information. */
  4996. /* */
  4997. /* <Also> */
  4998. /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
  4999. /* */
  5000. typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
  5001. /*************************************************************************/
  5002. /* */
  5003. /* <Type> */
  5004. /* FT_CharMap */
  5005. /* */
  5006. /* <Description> */
  5007. /* A handle to a given character map. A charmap is used to translate */
  5008. /* character codes in a given encoding into glyph indexes for its */
  5009. /* parent's face. Some font formats may provide several charmaps per */
  5010. /* font. */
  5011. /* */
  5012. /* Each face object owns zero or more charmaps, but only one of them */
  5013. /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
  5014. /* */
  5015. /* The list of available charmaps in a face is available through the */
  5016. /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
  5017. /* */
  5018. /* The currently active charmap is available as `face->charmap'. */
  5019. /* You should call @FT_Set_Charmap to change it. */
  5020. /* */
  5021. /* <Note> */
  5022. /* When a new face is created (either through @FT_New_Face or */
  5023. /* @FT_Open_Face), the library looks for a Unicode charmap within */
  5024. /* the list and automatically activates it. */
  5025. /* */
  5026. /* <Also> */
  5027. /* See @FT_CharMapRec for the publicly accessible fields of a given */
  5028. /* character map. */
  5029. /* */
  5030. typedef struct FT_CharMapRec_* FT_CharMap;
  5031. /*************************************************************************/
  5032. /* */
  5033. /* <Macro> */
  5034. /* FT_ENC_TAG */
  5035. /* */
  5036. /* <Description> */
  5037. /* This macro converts four-letter tags into an unsigned long. It is */
  5038. /* used to define `encoding' identifiers (see @FT_Encoding). */
  5039. /* */
  5040. /* <Note> */
  5041. /* Since many 16-bit compilers don't like 32-bit enumerations, you */
  5042. /* should redefine this macro in case of problems to something like */
  5043. /* this: */
  5044. /* */
  5045. /* { */
  5046. /* #define FT_ENC_TAG( value, a, b, c, d ) value */
  5047. /* } */
  5048. /* */
  5049. /* to get a simple enumeration without assigning special numbers. */
  5050. /* */
  5051. #ifndef FT_ENC_TAG
  5052. #define FT_ENC_TAG( value, a, b, c, d ) \
  5053. value = ( ( (FT_UInt32)(a) << 24 ) | \
  5054. ( (FT_UInt32)(b) << 16 ) | \
  5055. ( (FT_UInt32)(c) << 8 ) | \
  5056. (FT_UInt32)(d) )
  5057. #endif /* FT_ENC_TAG */
  5058. /*************************************************************************/
  5059. /* */
  5060. /* <Enum> */
  5061. /* FT_Encoding */
  5062. /* */
  5063. /* <Description> */
  5064. /* An enumeration used to specify character sets supported by */
  5065. /* charmaps. Used in the @FT_Select_Charmap API function. */
  5066. /* */
  5067. /* <Note> */
  5068. /* Despite the name, this enumeration lists specific character */
  5069. /* repertories (i.e., charsets), and not text encoding methods (e.g., */
  5070. /* UTF-8, UTF-16, etc.). */
  5071. /* */
  5072. /* Other encodings might be defined in the future. */
  5073. /* */
  5074. /* <Values> */
  5075. /* FT_ENCODING_NONE :: */
  5076. /* The encoding value~0 is reserved. */
  5077. /* */
  5078. /* FT_ENCODING_UNICODE :: */
  5079. /* Corresponds to the Unicode character set. This value covers */
  5080. /* all versions of the Unicode repertoire, including ASCII and */
  5081. /* Latin-1. Most fonts include a Unicode charmap, but not all */
  5082. /* of them. */
  5083. /* */
  5084. /* For example, if you want to access Unicode value U+1F028 (and */
  5085. /* the font contains it), use value 0x1F028 as the input value for */
  5086. /* @FT_Get_Char_Index. */
  5087. /* */
  5088. /* FT_ENCODING_MS_SYMBOL :: */
  5089. /* Corresponds to the Microsoft Symbol encoding, used to encode */
  5090. /* mathematical symbols in the 32..255 character code range. For */
  5091. /* more information, see `http://www.ceviz.net/symbol.htm'. */
  5092. /* */
  5093. /* FT_ENCODING_SJIS :: */
  5094. /* Corresponds to Japanese SJIS encoding. More info at */
  5095. /* at `http://langsupport.japanreference.com/encoding.shtml'. */
  5096. /* See note on multi-byte encodings below. */
  5097. /* */
  5098. /* FT_ENCODING_GB2312 :: */
  5099. /* Corresponds to an encoding system for Simplified Chinese as used */
  5100. /* used in mainland China. */
  5101. /* */
  5102. /* FT_ENCODING_BIG5 :: */
  5103. /* Corresponds to an encoding system for Traditional Chinese as */
  5104. /* used in Taiwan and Hong Kong. */
  5105. /* */
  5106. /* FT_ENCODING_WANSUNG :: */
  5107. /* Corresponds to the Korean encoding system known as Wansung. */
  5108. /* For more information see */
  5109. /* `http://www.microsoft.com/typography/unicode/949.txt'. */
  5110. /* */
  5111. /* FT_ENCODING_JOHAB :: */
  5112. /* The Korean standard character set (KS~C 5601-1992), which */
  5113. /* corresponds to MS Windows code page 1361. This character set */
  5114. /* includes all possible Hangeul character combinations. */
  5115. /* */
  5116. /* FT_ENCODING_ADOBE_LATIN_1 :: */
  5117. /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
  5118. /* PostScript font. It is limited to 256 character codes. */
  5119. /* */
  5120. /* FT_ENCODING_ADOBE_STANDARD :: */
  5121. /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
  5122. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  5123. /* codes. */
  5124. /* */
  5125. /* FT_ENCODING_ADOBE_EXPERT :: */
  5126. /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
  5127. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  5128. /* codes. */
  5129. /* */
  5130. /* FT_ENCODING_ADOBE_CUSTOM :: */
  5131. /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
  5132. /* OpenType/CFF fonts. It is limited to 256 character codes. */
  5133. /* */
  5134. /* FT_ENCODING_APPLE_ROMAN :: */
  5135. /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
  5136. /* and OpenType fonts contain a charmap for this encoding, since */
  5137. /* older versions of Mac OS are able to use it. */
  5138. /* */
  5139. /* FT_ENCODING_OLD_LATIN_2 :: */
  5140. /* This value is deprecated and was never used nor reported by */
  5141. /* FreeType. Don't use or test for it. */
  5142. /* */
  5143. /* FT_ENCODING_MS_SJIS :: */
  5144. /* Same as FT_ENCODING_SJIS. Deprecated. */
  5145. /* */
  5146. /* FT_ENCODING_MS_GB2312 :: */
  5147. /* Same as FT_ENCODING_GB2312. Deprecated. */
  5148. /* */
  5149. /* FT_ENCODING_MS_BIG5 :: */
  5150. /* Same as FT_ENCODING_BIG5. Deprecated. */
  5151. /* */
  5152. /* FT_ENCODING_MS_WANSUNG :: */
  5153. /* Same as FT_ENCODING_WANSUNG. Deprecated. */
  5154. /* */
  5155. /* FT_ENCODING_MS_JOHAB :: */
  5156. /* Same as FT_ENCODING_JOHAB. Deprecated. */
  5157. /* */
  5158. /* <Note> */
  5159. /* By default, FreeType automatically synthesizes a Unicode charmap */
  5160. /* for PostScript fonts, using their glyph names dictionaries. */
  5161. /* However, it also reports the encodings defined explicitly in the */
  5162. /* font file, for the cases when they are needed, with the Adobe */
  5163. /* values as well. */
  5164. /* */
  5165. /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
  5166. /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
  5167. /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
  5168. /* which encoding is really present. If, for example, the */
  5169. /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
  5170. /* the font is encoded in KOI8-R. */
  5171. /* */
  5172. /* FT_ENCODING_NONE is always set (with a single exception) by the */
  5173. /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
  5174. /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
  5175. /* which encoding is really present. For example, */
  5176. /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
  5177. /* Russian). */
  5178. /* */
  5179. /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
  5180. /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
  5181. /* FT_ENCODING_APPLE_ROMAN). */
  5182. /* */
  5183. /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
  5184. /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */
  5185. /* be needed to be able to distinguish Apple encoding variants. See */
  5186. /* */
  5187. /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
  5188. /* */
  5189. /* to get an idea how to do that. Basically, if the language ID */
  5190. /* is~0, don't use it, otherwise subtract 1 from the language ID. */
  5191. /* Then examine `encoding_id'. If, for example, `encoding_id' is */
  5192. /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
  5193. /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
  5194. /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
  5195. /* variant the Arabic encoding. */
  5196. /* */
  5197. typedef enum FT_Encoding_
  5198. {
  5199. FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
  5200. FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
  5201. FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
  5202. FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
  5203. FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
  5204. FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
  5205. FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
  5206. FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
  5207. /* for backwards compatibility */
  5208. FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
  5209. FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
  5210. FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
  5211. FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
  5212. FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
  5213. FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
  5214. FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
  5215. FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
  5216. FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
  5217. FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
  5218. FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
  5219. } FT_Encoding;
  5220. /*************************************************************************/
  5221. /* */
  5222. /* <Enum> */
  5223. /* ft_encoding_xxx */
  5224. /* */
  5225. /* <Description> */
  5226. /* These constants are deprecated; use the corresponding @FT_Encoding */
  5227. /* values instead. */
  5228. /* */
  5229. #define ft_encoding_none FT_ENCODING_NONE
  5230. #define ft_encoding_unicode FT_ENCODING_UNICODE
  5231. #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
  5232. #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
  5233. #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
  5234. #define ft_encoding_sjis FT_ENCODING_SJIS
  5235. #define ft_encoding_gb2312 FT_ENCODING_GB2312
  5236. #define ft_encoding_big5 FT_ENCODING_BIG5
  5237. #define ft_encoding_wansung FT_ENCODING_WANSUNG
  5238. #define ft_encoding_johab FT_ENCODING_JOHAB
  5239. #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
  5240. #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
  5241. #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
  5242. #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
  5243. /*************************************************************************/
  5244. /* */
  5245. /* <Struct> */
  5246. /* FT_CharMapRec */
  5247. /* */
  5248. /* <Description> */
  5249. /* The base charmap structure. */
  5250. /* */
  5251. /* <Fields> */
  5252. /* face :: A handle to the parent face object. */
  5253. /* */
  5254. /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
  5255. /* this with @FT_Select_Charmap. */
  5256. /* */
  5257. /* platform_id :: An ID number describing the platform for the */
  5258. /* following encoding ID. This comes directly from */
  5259. /* the TrueType specification and should be emulated */
  5260. /* for other formats. */
  5261. /* */
  5262. /* encoding_id :: A platform specific encoding number. This also */
  5263. /* comes from the TrueType specification and should be */
  5264. /* emulated similarly. */
  5265. /* */
  5266. typedef struct FT_CharMapRec_
  5267. {
  5268. FT_Face face;
  5269. FT_Encoding encoding;
  5270. FT_UShort platform_id;
  5271. FT_UShort encoding_id;
  5272. } FT_CharMapRec;
  5273. /*************************************************************************/
  5274. /*************************************************************************/
  5275. /* */
  5276. /* B A S E O B J E C T C L A S S E S */
  5277. /* */
  5278. /*************************************************************************/
  5279. /*************************************************************************/
  5280. /*************************************************************************/
  5281. /* */
  5282. /* <Type> */
  5283. /* FT_Face_Internal */
  5284. /* */
  5285. /* <Description> */
  5286. /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
  5287. /* model private data of a given @FT_Face object. */
  5288. /* */
  5289. /* This structure might change between releases of FreeType~2 and is */
  5290. /* not generally available to client applications. */
  5291. /* */
  5292. typedef struct FT_Face_InternalRec_* FT_Face_Internal;
  5293. /*************************************************************************/
  5294. /* */
  5295. /* <Struct> */
  5296. /* FT_FaceRec */
  5297. /* */
  5298. /* <Description> */
  5299. /* FreeType root face class structure. A face object models a */
  5300. /* typeface in a font file. */
  5301. /* */
  5302. /* <Fields> */
  5303. /* num_faces :: The number of faces in the font file. Some */
  5304. /* font formats can have multiple faces in */
  5305. /* a font file. */
  5306. /* */
  5307. /* face_index :: The index of the face in the font file. It */
  5308. /* is set to~0 if there is only one face in */
  5309. /* the font file. */
  5310. /* */
  5311. /* face_flags :: A set of bit flags that give important */
  5312. /* information about the face; see */
  5313. /* @FT_FACE_FLAG_XXX for the details. */
  5314. /* */
  5315. /* style_flags :: A set of bit flags indicating the style of */
  5316. /* the face; see @FT_STYLE_FLAG_XXX for the */
  5317. /* details. */
  5318. /* */
  5319. /* num_glyphs :: The number of glyphs in the face. If the */
  5320. /* face is scalable and has sbits (see */
  5321. /* `num_fixed_sizes'), it is set to the number */
  5322. /* of outline glyphs. */
  5323. /* */
  5324. /* For CID-keyed fonts, this value gives the */
  5325. /* highest CID used in the font. */
  5326. /* */
  5327. /* family_name :: The face's family name. This is an ASCII */
  5328. /* string, usually in English, which describes */
  5329. /* the typeface's family (like `Times New */
  5330. /* Roman', `Bodoni', `Garamond', etc). This */
  5331. /* is a least common denominator used to list */
  5332. /* fonts. Some formats (TrueType & OpenType) */
  5333. /* provide localized and Unicode versions of */
  5334. /* this string. Applications should use the */
  5335. /* format specific interface to access them. */
  5336. /* Can be NULL (e.g., in fonts embedded in a */
  5337. /* PDF file). */
  5338. /* */
  5339. /* style_name :: The face's style name. This is an ASCII */
  5340. /* string, usually in English, which describes */
  5341. /* the typeface's style (like `Italic', */
  5342. /* `Bold', `Condensed', etc). Not all font */
  5343. /* formats provide a style name, so this field */
  5344. /* is optional, and can be set to NULL. As */
  5345. /* for `family_name', some formats provide */
  5346. /* localized and Unicode versions of this */
  5347. /* string. Applications should use the format */
  5348. /* specific interface to access them. */
  5349. /* */
  5350. /* num_fixed_sizes :: The number of bitmap strikes in the face. */
  5351. /* Even if the face is scalable, there might */
  5352. /* still be bitmap strikes, which are called */
  5353. /* `sbits' in that case. */
  5354. /* */
  5355. /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
  5356. /* strikes in the face. It is set to NULL if */
  5357. /* there is no bitmap strike. */
  5358. /* */
  5359. /* num_charmaps :: The number of charmaps in the face. */
  5360. /* */
  5361. /* charmaps :: An array of the charmaps of the face. */
  5362. /* */
  5363. /* generic :: A field reserved for client uses. See the */
  5364. /* @FT_Generic type description. */
  5365. /* */
  5366. /* bbox :: The font bounding box. Coordinates are */
  5367. /* expressed in font units (see */
  5368. /* `units_per_EM'). The box is large enough */
  5369. /* to contain any glyph from the font. Thus, */
  5370. /* `bbox.yMax' can be seen as the `maximum */
  5371. /* ascender', and `bbox.yMin' as the `minimum */
  5372. /* descender'. Only relevant for scalable */
  5373. /* formats. */
  5374. /* */
  5375. /* Note that the bounding box might be off by */
  5376. /* (at least) one pixel for hinted fonts. See */
  5377. /* @FT_Size_Metrics for further discussion. */
  5378. /* */
  5379. /* units_per_EM :: The number of font units per EM square for */
  5380. /* this face. This is typically 2048 for */
  5381. /* TrueType fonts, and 1000 for Type~1 fonts. */
  5382. /* Only relevant for scalable formats. */
  5383. /* */
  5384. /* ascender :: The typographic ascender of the face, */
  5385. /* expressed in font units. For font formats */
  5386. /* not having this information, it is set to */
  5387. /* `bbox.yMax'. Only relevant for scalable */
  5388. /* formats. */
  5389. /* */
  5390. /* descender :: The typographic descender of the face, */
  5391. /* expressed in font units. For font formats */
  5392. /* not having this information, it is set to */
  5393. /* `bbox.yMin'. Note that this field is */
  5394. /* usually negative. Only relevant for */
  5395. /* scalable formats. */
  5396. /* */
  5397. /* height :: This value is the vertical distance */
  5398. /* between two consecutive baselines, */
  5399. /* expressed in font units. It is always */
  5400. /* positive. Only relevant for scalable */
  5401. /* formats. */
  5402. /* */
  5403. /* If you want the global glyph height, use */
  5404. /* `ascender - descender'. */
  5405. /* */
  5406. /* max_advance_width :: The maximum advance width, in font units, */
  5407. /* for all glyphs in this face. This can be */
  5408. /* used to make word wrapping computations */
  5409. /* faster. Only relevant for scalable */
  5410. /* formats. */
  5411. /* */
  5412. /* max_advance_height :: The maximum advance height, in font units, */
  5413. /* for all glyphs in this face. This is only */
  5414. /* relevant for vertical layouts, and is set */
  5415. /* to `height' for fonts that do not provide */
  5416. /* vertical metrics. Only relevant for */
  5417. /* scalable formats. */
  5418. /* */
  5419. /* underline_position :: The position, in font units, of the */
  5420. /* underline line for this face. It is the */
  5421. /* center of the underlining stem. Only */
  5422. /* relevant for scalable formats. */
  5423. /* */
  5424. /* underline_thickness :: The thickness, in font units, of the */
  5425. /* underline for this face. Only relevant for */
  5426. /* scalable formats. */
  5427. /* */
  5428. /* glyph :: The face's associated glyph slot(s). */
  5429. /* */
  5430. /* size :: The current active size for this face. */
  5431. /* */
  5432. /* charmap :: The current active charmap for this face. */
  5433. /* */
  5434. /* <Note> */
  5435. /* Fields may be changed after a call to @FT_Attach_File or */
  5436. /* @FT_Attach_Stream. */
  5437. /* */
  5438. typedef struct FT_FaceRec_
  5439. {
  5440. FT_Long num_faces;
  5441. FT_Long face_index;
  5442. FT_Long face_flags;
  5443. FT_Long style_flags;
  5444. FT_Long num_glyphs;
  5445. FT_String* family_name;
  5446. FT_String* style_name;
  5447. FT_Int num_fixed_sizes;
  5448. FT_Bitmap_Size* available_sizes;
  5449. FT_Int num_charmaps;
  5450. FT_CharMap* charmaps;
  5451. FT_Generic generic;
  5452. /*# The following member variables (down to `underline_thickness') */
  5453. /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
  5454. /*# for bitmap fonts. */
  5455. FT_BBox bbox;
  5456. FT_UShort units_per_EM;
  5457. FT_Short ascender;
  5458. FT_Short descender;
  5459. FT_Short height;
  5460. FT_Short max_advance_width;
  5461. FT_Short max_advance_height;
  5462. FT_Short underline_position;
  5463. FT_Short underline_thickness;
  5464. FT_GlyphSlot glyph;
  5465. FT_Size size;
  5466. FT_CharMap charmap;
  5467. /*@private begin */
  5468. FT_Driver driver;
  5469. FT_Memory memory;
  5470. FT_Stream stream;
  5471. FT_ListRec sizes_list;
  5472. FT_Generic autohint; /* face-specific auto-hinter data */
  5473. void* extensions; /* unused */
  5474. FT_Face_Internal internal;
  5475. /*@private end */
  5476. } FT_FaceRec;
  5477. /*************************************************************************/
  5478. /* */
  5479. /* <Enum> */
  5480. /* FT_FACE_FLAG_XXX */
  5481. /* */
  5482. /* <Description> */
  5483. /* A list of bit flags used in the `face_flags' field of the */
  5484. /* @FT_FaceRec structure. They inform client applications of */
  5485. /* properties of the corresponding face. */
  5486. /* */
  5487. /* <Values> */
  5488. /* FT_FACE_FLAG_SCALABLE :: */
  5489. /* Indicates that the face contains outline glyphs. This doesn't */
  5490. /* prevent bitmap strikes, i.e., a face can have both this and */
  5491. /* and @FT_FACE_FLAG_FIXED_SIZES set. */
  5492. /* */
  5493. /* FT_FACE_FLAG_FIXED_SIZES :: */
  5494. /* Indicates that the face contains bitmap strikes. See also the */
  5495. /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
  5496. /* */
  5497. /* FT_FACE_FLAG_FIXED_WIDTH :: */
  5498. /* Indicates that the face contains fixed-width characters (like */
  5499. /* Courier, Lucido, MonoType, etc.). */
  5500. /* */
  5501. /* FT_FACE_FLAG_SFNT :: */
  5502. /* Indicates that the face uses the `sfnt' storage scheme. For */
  5503. /* now, this means TrueType and OpenType. */
  5504. /* */
  5505. /* FT_FACE_FLAG_HORIZONTAL :: */
  5506. /* Indicates that the face contains horizontal glyph metrics. This */
  5507. /* should be set for all common formats. */
  5508. /* */
  5509. /* FT_FACE_FLAG_VERTICAL :: */
  5510. /* Indicates that the face contains vertical glyph metrics. This */
  5511. /* is only available in some formats, not all of them. */
  5512. /* */
  5513. /* FT_FACE_FLAG_KERNING :: */
  5514. /* Indicates that the face contains kerning information. If set, */
  5515. /* the kerning distance can be retrieved through the function */
  5516. /* @FT_Get_Kerning. Otherwise the function always return the */
  5517. /* vector (0,0). Note that FreeType doesn't handle kerning data */
  5518. /* from the `GPOS' table (as present in some OpenType fonts). */
  5519. /* */
  5520. /* FT_FACE_FLAG_FAST_GLYPHS :: */
  5521. /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
  5522. /* */
  5523. /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
  5524. /* Indicates that the font contains multiple masters and is capable */
  5525. /* of interpolating between them. See the multiple-masters */
  5526. /* specific API for details. */
  5527. /* */
  5528. /* FT_FACE_FLAG_GLYPH_NAMES :: */
  5529. /* Indicates that the font contains glyph names that can be */
  5530. /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
  5531. /* fonts contain broken glyph name tables. Use the function */
  5532. /* @FT_Has_PS_Glyph_Names when needed. */
  5533. /* */
  5534. /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
  5535. /* Used internally by FreeType to indicate that a face's stream was */
  5536. /* provided by the client application and should not be destroyed */
  5537. /* when @FT_Done_Face is called. Don't read or test this flag. */
  5538. /* */
  5539. /* FT_FACE_FLAG_HINTER :: */
  5540. /* Set if the font driver has a hinting machine of its own. For */
  5541. /* example, with TrueType fonts, it makes sense to use data from */
  5542. /* the SFNT `gasp' table only if the native TrueType hinting engine */
  5543. /* (with the bytecode interpreter) is available and active. */
  5544. /* */
  5545. /* FT_FACE_FLAG_CID_KEYED :: */
  5546. /* Set if the font is CID-keyed. In that case, the font is not */
  5547. /* accessed by glyph indices but by CID values. For subsetted */
  5548. /* CID-keyed fonts this has the consequence that not all index */
  5549. /* values are a valid argument to FT_Load_Glyph. Only the CID */
  5550. /* values for which corresponding glyphs in the subsetted font */
  5551. /* exist make FT_Load_Glyph return successfully; in all other cases */
  5552. /* you get an `FT_Err_Invalid_Argument' error. */
  5553. /* */
  5554. /* Note that CID-keyed fonts which are in an SFNT wrapper don't */
  5555. /* have this flag set since the glyphs are accessed in the normal */
  5556. /* way (using contiguous indices); the `CID-ness' isn't visible to */
  5557. /* the application. */
  5558. /* */
  5559. /* FT_FACE_FLAG_TRICKY :: */
  5560. /* Set if the font is `tricky', this is, it always needs the */
  5561. /* font format's native hinting engine to get a reasonable result. */
  5562. /* A typical example is the Chinese font `mingli.ttf' which uses */
  5563. /* TrueType bytecode instructions to move and scale all of its */
  5564. /* subglyphs. */
  5565. /* */
  5566. /* It is not possible to autohint such fonts using */
  5567. /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
  5568. /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
  5569. /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
  5570. /* probably never want this except for demonstration purposes. */
  5571. /* */
  5572. /* Currently, there are about a dozen TrueType fonts in the list of */
  5573. /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
  5574. /* */
  5575. #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
  5576. #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
  5577. #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
  5578. #define FT_FACE_FLAG_SFNT ( 1L << 3 )
  5579. #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
  5580. #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
  5581. #define FT_FACE_FLAG_KERNING ( 1L << 6 )
  5582. #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
  5583. #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
  5584. #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
  5585. #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
  5586. #define FT_FACE_FLAG_HINTER ( 1L << 11 )
  5587. #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
  5588. #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
  5589. /*************************************************************************
  5590. *
  5591. * @macro:
  5592. * FT_HAS_HORIZONTAL( face )
  5593. *
  5594. * @description:
  5595. * A macro that returns true whenever a face object contains
  5596. * horizontal metrics (this is true for all font formats though).
  5597. *
  5598. * @also:
  5599. * @FT_HAS_VERTICAL can be used to check for vertical metrics.
  5600. *
  5601. */
  5602. #define FT_HAS_HORIZONTAL( face ) \
  5603. ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
  5604. /*************************************************************************
  5605. *
  5606. * @macro:
  5607. * FT_HAS_VERTICAL( face )
  5608. *
  5609. * @description:
  5610. * A macro that returns true whenever a face object contains real
  5611. * vertical metrics (and not only synthesized ones).
  5612. *
  5613. */
  5614. #define FT_HAS_VERTICAL( face ) \
  5615. ( face->face_flags & FT_FACE_FLAG_VERTICAL )
  5616. /*************************************************************************
  5617. *
  5618. * @macro:
  5619. * FT_HAS_KERNING( face )
  5620. *
  5621. * @description:
  5622. * A macro that returns true whenever a face object contains kerning
  5623. * data that can be accessed with @FT_Get_Kerning.
  5624. *
  5625. */
  5626. #define FT_HAS_KERNING( face ) \
  5627. ( face->face_flags & FT_FACE_FLAG_KERNING )
  5628. /*************************************************************************
  5629. *
  5630. * @macro:
  5631. * FT_IS_SCALABLE( face )
  5632. *
  5633. * @description:
  5634. * A macro that returns true whenever a face object contains a scalable
  5635. * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
  5636. * and PFR font formats.
  5637. *
  5638. */
  5639. #define FT_IS_SCALABLE( face ) \
  5640. ( face->face_flags & FT_FACE_FLAG_SCALABLE )
  5641. /*************************************************************************
  5642. *
  5643. * @macro:
  5644. * FT_IS_SFNT( face )
  5645. *
  5646. * @description:
  5647. * A macro that returns true whenever a face object contains a font
  5648. * whose format is based on the SFNT storage scheme. This usually
  5649. * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
  5650. * bitmap fonts.
  5651. *
  5652. * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
  5653. * @FT_TRUETYPE_TABLES_H are available.
  5654. *
  5655. */
  5656. #define FT_IS_SFNT( face ) \
  5657. ( face->face_flags & FT_FACE_FLAG_SFNT )
  5658. /*************************************************************************
  5659. *
  5660. * @macro:
  5661. * FT_IS_FIXED_WIDTH( face )
  5662. *
  5663. * @description:
  5664. * A macro that returns true whenever a face object contains a font face
  5665. * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
  5666. * glyphs.
  5667. *
  5668. */
  5669. #define FT_IS_FIXED_WIDTH( face ) \
  5670. ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
  5671. /*************************************************************************
  5672. *
  5673. * @macro:
  5674. * FT_HAS_FIXED_SIZES( face )
  5675. *
  5676. * @description:
  5677. * A macro that returns true whenever a face object contains some
  5678. * embedded bitmaps. See the `available_sizes' field of the
  5679. * @FT_FaceRec structure.
  5680. *
  5681. */
  5682. #define FT_HAS_FIXED_SIZES( face ) \
  5683. ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
  5684. /*************************************************************************
  5685. *
  5686. * @macro:
  5687. * FT_HAS_FAST_GLYPHS( face )
  5688. *
  5689. * @description:
  5690. * Deprecated.
  5691. *
  5692. */
  5693. #define FT_HAS_FAST_GLYPHS( face ) 0
  5694. /*************************************************************************
  5695. *
  5696. * @macro:
  5697. * FT_HAS_GLYPH_NAMES( face )
  5698. *
  5699. * @description:
  5700. * A macro that returns true whenever a face object contains some glyph
  5701. * names that can be accessed through @FT_Get_Glyph_Name.
  5702. *
  5703. */
  5704. #define FT_HAS_GLYPH_NAMES( face ) \
  5705. ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
  5706. /*************************************************************************
  5707. *
  5708. * @macro:
  5709. * FT_HAS_MULTIPLE_MASTERS( face )
  5710. *
  5711. * @description:
  5712. * A macro that returns true whenever a face object contains some
  5713. * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
  5714. * are then available to choose the exact design you want.
  5715. *
  5716. */
  5717. #define FT_HAS_MULTIPLE_MASTERS( face ) \
  5718. ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
  5719. /*************************************************************************
  5720. *
  5721. * @macro:
  5722. * FT_IS_CID_KEYED( face )
  5723. *
  5724. * @description:
  5725. * A macro that returns true whenever a face object contains a CID-keyed
  5726. * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
  5727. * details.
  5728. *
  5729. * If this macro is true, all functions defined in @FT_CID_H are
  5730. * available.
  5731. *
  5732. */
  5733. #define FT_IS_CID_KEYED( face ) \
  5734. ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
  5735. /*************************************************************************
  5736. *
  5737. * @macro:
  5738. * FT_IS_TRICKY( face )
  5739. *
  5740. * @description:
  5741. * A macro that returns true whenever a face represents a `tricky' font.
  5742. * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
  5743. *
  5744. */
  5745. #define FT_IS_TRICKY( face ) \
  5746. ( face->face_flags & FT_FACE_FLAG_TRICKY )
  5747. /*************************************************************************/
  5748. /* */
  5749. /* <Const> */
  5750. /* FT_STYLE_FLAG_XXX */
  5751. /* */
  5752. /* <Description> */
  5753. /* A list of bit-flags used to indicate the style of a given face. */
  5754. /* These are used in the `style_flags' field of @FT_FaceRec. */
  5755. /* */
  5756. /* <Values> */
  5757. /* FT_STYLE_FLAG_ITALIC :: */
  5758. /* Indicates that a given face style is italic or oblique. */
  5759. /* */
  5760. /* FT_STYLE_FLAG_BOLD :: */
  5761. /* Indicates that a given face is bold. */
  5762. /* */
  5763. /* <Note> */
  5764. /* The style information as provided by FreeType is very basic. More */
  5765. /* details are beyond the scope and should be done on a higher level */
  5766. /* (for example, by analyzing various fields of the `OS/2' table in */
  5767. /* SFNT based fonts). */
  5768. /* */
  5769. #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
  5770. #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
  5771. /*************************************************************************/
  5772. /* */
  5773. /* <Type> */
  5774. /* FT_Size_Internal */
  5775. /* */
  5776. /* <Description> */
  5777. /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
  5778. /* model private data of a given @FT_Size object. */
  5779. /* */
  5780. typedef struct FT_Size_InternalRec_* FT_Size_Internal;
  5781. /*************************************************************************/
  5782. /* */
  5783. /* <Struct> */
  5784. /* FT_Size_Metrics */
  5785. /* */
  5786. /* <Description> */
  5787. /* The size metrics structure gives the metrics of a size object. */
  5788. /* */
  5789. /* <Fields> */
  5790. /* x_ppem :: The width of the scaled EM square in pixels, hence */
  5791. /* the term `ppem' (pixels per EM). It is also */
  5792. /* referred to as `nominal width'. */
  5793. /* */
  5794. /* y_ppem :: The height of the scaled EM square in pixels, */
  5795. /* hence the term `ppem' (pixels per EM). It is also */
  5796. /* referred to as `nominal height'. */
  5797. /* */
  5798. /* x_scale :: A 16.16 fractional scaling value used to convert */
  5799. /* horizontal metrics from font units to 26.6 */
  5800. /* fractional pixels. Only relevant for scalable */
  5801. /* font formats. */
  5802. /* */
  5803. /* y_scale :: A 16.16 fractional scaling value used to convert */
  5804. /* vertical metrics from font units to 26.6 */
  5805. /* fractional pixels. Only relevant for scalable */
  5806. /* font formats. */
  5807. /* */
  5808. /* ascender :: The ascender in 26.6 fractional pixels. See */
  5809. /* @FT_FaceRec for the details. */
  5810. /* */
  5811. /* descender :: The descender in 26.6 fractional pixels. See */
  5812. /* @FT_FaceRec for the details. */
  5813. /* */
  5814. /* height :: The height in 26.6 fractional pixels. See */
  5815. /* @FT_FaceRec for the details. */
  5816. /* */
  5817. /* max_advance :: The maximum advance width in 26.6 fractional */
  5818. /* pixels. See @FT_FaceRec for the details. */
  5819. /* */
  5820. /* <Note> */
  5821. /* The scaling values, if relevant, are determined first during a */
  5822. /* size changing operation. The remaining fields are then set by the */
  5823. /* driver. For scalable formats, they are usually set to scaled */
  5824. /* values of the corresponding fields in @FT_FaceRec. */
  5825. /* */
  5826. /* Note that due to glyph hinting, these values might not be exact */
  5827. /* for certain fonts. Thus they must be treated as unreliable */
  5828. /* with an error margin of at least one pixel! */
  5829. /* */
  5830. /* Indeed, the only way to get the exact metrics is to render _all_ */
  5831. /* glyphs. As this would be a definite performance hit, it is up to */
  5832. /* client applications to perform such computations. */
  5833. /* */
  5834. /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
  5835. /* */
  5836. typedef struct FT_Size_Metrics_
  5837. {
  5838. FT_UShort x_ppem; /* horizontal pixels per EM */
  5839. FT_UShort y_ppem; /* vertical pixels per EM */
  5840. FT_Fixed x_scale; /* scaling values used to convert font */
  5841. FT_Fixed y_scale; /* units to 26.6 fractional pixels */
  5842. FT_Pos ascender; /* ascender in 26.6 frac. pixels */
  5843. FT_Pos descender; /* descender in 26.6 frac. pixels */
  5844. FT_Pos height; /* text height in 26.6 frac. pixels */
  5845. FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
  5846. } FT_Size_Metrics;
  5847. /*************************************************************************/
  5848. /* */
  5849. /* <Struct> */
  5850. /* FT_SizeRec */
  5851. /* */
  5852. /* <Description> */
  5853. /* FreeType root size class structure. A size object models a face */
  5854. /* object at a given size. */
  5855. /* */
  5856. /* <Fields> */
  5857. /* face :: Handle to the parent face object. */
  5858. /* */
  5859. /* generic :: A typeless pointer, which is unused by the FreeType */
  5860. /* library or any of its drivers. It can be used by */
  5861. /* client applications to link their own data to each size */
  5862. /* object. */
  5863. /* */
  5864. /* metrics :: Metrics for this size object. This field is read-only. */
  5865. /* */
  5866. typedef struct FT_SizeRec_
  5867. {
  5868. FT_Face face; /* parent face object */
  5869. FT_Generic generic; /* generic pointer for client uses */
  5870. FT_Size_Metrics metrics; /* size metrics */
  5871. FT_Size_Internal internal;
  5872. } FT_SizeRec;
  5873. /*************************************************************************/
  5874. /* */
  5875. /* <Struct> */
  5876. /* FT_SubGlyph */
  5877. /* */
  5878. /* <Description> */
  5879. /* The subglyph structure is an internal object used to describe */
  5880. /* subglyphs (for example, in the case of composites). */
  5881. /* */
  5882. /* <Note> */
  5883. /* The subglyph implementation is not part of the high-level API, */
  5884. /* hence the forward structure declaration. */
  5885. /* */
  5886. /* You can however retrieve subglyph information with */
  5887. /* @FT_Get_SubGlyph_Info. */
  5888. /* */
  5889. typedef struct FT_SubGlyphRec_* FT_SubGlyph;
  5890. /*************************************************************************/
  5891. /* */
  5892. /* <Type> */
  5893. /* FT_Slot_Internal */
  5894. /* */
  5895. /* <Description> */
  5896. /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
  5897. /* model private data of a given @FT_GlyphSlot object. */
  5898. /* */
  5899. typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
  5900. /*************************************************************************/
  5901. /* */
  5902. /* <Struct> */
  5903. /* FT_GlyphSlotRec */
  5904. /* */
  5905. /* <Description> */
  5906. /* FreeType root glyph slot class structure. A glyph slot is a */
  5907. /* container where individual glyphs can be loaded, be they in */
  5908. /* outline or bitmap format. */
  5909. /* */
  5910. /* <Fields> */
  5911. /* library :: A handle to the FreeType library instance */
  5912. /* this slot belongs to. */
  5913. /* */
  5914. /* face :: A handle to the parent face object. */
  5915. /* */
  5916. /* next :: In some cases (like some font tools), several */
  5917. /* glyph slots per face object can be a good */
  5918. /* thing. As this is rare, the glyph slots are */
  5919. /* listed through a direct, single-linked list */
  5920. /* using its `next' field. */
  5921. /* */
  5922. /* generic :: A typeless pointer which is unused by the */
  5923. /* FreeType library or any of its drivers. It */
  5924. /* can be used by client applications to link */
  5925. /* their own data to each glyph slot object. */
  5926. /* */
  5927. /* metrics :: The metrics of the last loaded glyph in the */
  5928. /* slot. The returned values depend on the last */
  5929. /* load flags (see the @FT_Load_Glyph API */
  5930. /* function) and can be expressed either in 26.6 */
  5931. /* fractional pixels or font units. */
  5932. /* */
  5933. /* Note that even when the glyph image is */
  5934. /* transformed, the metrics are not. */
  5935. /* */
  5936. /* linearHoriAdvance :: The advance width of the unhinted glyph. */
  5937. /* Its value is expressed in 16.16 fractional */
  5938. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  5939. /* when loading the glyph. This field can be */
  5940. /* important to perform correct WYSIWYG layout. */
  5941. /* Only relevant for outline glyphs. */
  5942. /* */
  5943. /* linearVertAdvance :: The advance height of the unhinted glyph. */
  5944. /* Its value is expressed in 16.16 fractional */
  5945. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  5946. /* when loading the glyph. This field can be */
  5947. /* important to perform correct WYSIWYG layout. */
  5948. /* Only relevant for outline glyphs. */
  5949. /* */
  5950. /* advance :: This shorthand is, depending on */
  5951. /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
  5952. /* advance width for the glyph (in 26.6 */
  5953. /* fractional pixel format). As specified with */
  5954. /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
  5955. /* `horiAdvance' or the `vertAdvance' value of */
  5956. /* `metrics' field. */
  5957. /* */
  5958. /* format :: This field indicates the format of the image */
  5959. /* contained in the glyph slot. Typically */
  5960. /* @FT_GLYPH_FORMAT_BITMAP, */
  5961. /* @FT_GLYPH_FORMAT_OUTLINE, or */
  5962. /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
  5963. /* possible. */
  5964. /* */
  5965. /* bitmap :: This field is used as a bitmap descriptor */
  5966. /* when the slot format is */
  5967. /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
  5968. /* address and content of the bitmap buffer can */
  5969. /* change between calls of @FT_Load_Glyph and a */
  5970. /* few other functions. */
  5971. /* */
  5972. /* bitmap_left :: This is the bitmap's left bearing expressed */
  5973. /* in integer pixels. Of course, this is only */
  5974. /* valid if the format is */
  5975. /* @FT_GLYPH_FORMAT_BITMAP. */
  5976. /* */
  5977. /* bitmap_top :: This is the bitmap's top bearing expressed in */
  5978. /* integer pixels. Remember that this is the */
  5979. /* distance from the baseline to the top-most */
  5980. /* glyph scanline, upwards y~coordinates being */
  5981. /* *positive*. */
  5982. /* */
  5983. /* outline :: The outline descriptor for the current glyph */
  5984. /* image if its format is */
  5985. /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
  5986. /* loaded, `outline' can be transformed, */
  5987. /* distorted, embolded, etc. However, it must */
  5988. /* not be freed. */
  5989. /* */
  5990. /* num_subglyphs :: The number of subglyphs in a composite glyph. */
  5991. /* This field is only valid for the composite */
  5992. /* glyph format that should normally only be */
  5993. /* loaded with the @FT_LOAD_NO_RECURSE flag. */
  5994. /* For now this is internal to FreeType. */
  5995. /* */
  5996. /* subglyphs :: An array of subglyph descriptors for */
  5997. /* composite glyphs. There are `num_subglyphs' */
  5998. /* elements in there. Currently internal to */
  5999. /* FreeType. */
  6000. /* */
  6001. /* control_data :: Certain font drivers can also return the */
  6002. /* control data for a given glyph image (e.g. */
  6003. /* TrueType bytecode, Type~1 charstrings, etc.). */
  6004. /* This field is a pointer to such data. */
  6005. /* */
  6006. /* control_len :: This is the length in bytes of the control */
  6007. /* data. */
  6008. /* */
  6009. /* other :: Really wicked formats can use this pointer to */
  6010. /* present their own glyph image to client */
  6011. /* applications. Note that the application */
  6012. /* needs to know about the image format. */
  6013. /* */
  6014. /* lsb_delta :: The difference between hinted and unhinted */
  6015. /* left side bearing while autohinting is */
  6016. /* active. Zero otherwise. */
  6017. /* */
  6018. /* rsb_delta :: The difference between hinted and unhinted */
  6019. /* right side bearing while autohinting is */
  6020. /* active. Zero otherwise. */
  6021. /* */
  6022. /* <Note> */
  6023. /* If @FT_Load_Glyph is called with default flags (see */
  6024. /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
  6025. /* its native format (e.g., an outline glyph for TrueType and Type~1 */
  6026. /* formats). */
  6027. /* */
  6028. /* This image can later be converted into a bitmap by calling */
  6029. /* @FT_Render_Glyph. This function finds the current renderer for */
  6030. /* the native image's format, then invokes it. */
  6031. /* */
  6032. /* The renderer is in charge of transforming the native image through */
  6033. /* the slot's face transformation fields, then converting it into a */
  6034. /* bitmap that is returned in `slot->bitmap'. */
  6035. /* */
  6036. /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
  6037. /* to specify the position of the bitmap relative to the current pen */
  6038. /* position (e.g., coordinates (0,0) on the baseline). Of course, */
  6039. /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
  6040. /* */
  6041. /* <Note> */
  6042. /* Here a small pseudo code fragment which shows how to use */
  6043. /* `lsb_delta' and `rsb_delta': */
  6044. /* */
  6045. /* { */
  6046. /* FT_Pos origin_x = 0; */
  6047. /* FT_Pos prev_rsb_delta = 0; */
  6048. /* */
  6049. /* */
  6050. /* for all glyphs do */
  6051. /* <compute kern between current and previous glyph and add it to */
  6052. /* `origin_x'> */
  6053. /* */
  6054. /* <load glyph with `FT_Load_Glyph'> */
  6055. /* */
  6056. /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
  6057. /* origin_x -= 64; */
  6058. /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
  6059. /* origin_x += 64; */
  6060. /* */
  6061. /* prev_rsb_delta = face->glyph->rsb_delta; */
  6062. /* */
  6063. /* <save glyph image, or render glyph, or ...> */
  6064. /* */
  6065. /* origin_x += face->glyph->advance.x; */
  6066. /* endfor */
  6067. /* } */
  6068. /* */
  6069. typedef struct FT_GlyphSlotRec_
  6070. {
  6071. FT_Library library;
  6072. FT_Face face;
  6073. FT_GlyphSlot next;
  6074. FT_UInt reserved; /* retained for binary compatibility */
  6075. FT_Generic generic;
  6076. FT_Glyph_Metrics metrics;
  6077. FT_Fixed linearHoriAdvance;
  6078. FT_Fixed linearVertAdvance;
  6079. FT_Vector advance;
  6080. FT_Glyph_Format format;
  6081. FT_Bitmap bitmap;
  6082. FT_Int bitmap_left;
  6083. FT_Int bitmap_top;
  6084. FT_Outline outline;
  6085. FT_UInt num_subglyphs;
  6086. FT_SubGlyph subglyphs;
  6087. void* control_data;
  6088. long control_len;
  6089. FT_Pos lsb_delta;
  6090. FT_Pos rsb_delta;
  6091. void* other;
  6092. FT_Slot_Internal internal;
  6093. } FT_GlyphSlotRec;
  6094. /*************************************************************************/
  6095. /*************************************************************************/
  6096. /* */
  6097. /* F U N C T I O N S */
  6098. /* */
  6099. /*************************************************************************/
  6100. /*************************************************************************/
  6101. /*************************************************************************/
  6102. /* */
  6103. /* <Function> */
  6104. /* FT_Init_FreeType */
  6105. /* */
  6106. /* <Description> */
  6107. /* Initialize a new FreeType library object. The set of modules */
  6108. /* that are registered by this function is determined at build time. */
  6109. /* */
  6110. /* <Output> */
  6111. /* alibrary :: A handle to a new library object. */
  6112. /* */
  6113. /* <Return> */
  6114. /* FreeType error code. 0~means success. */
  6115. /* */
  6116. /* <Note> */
  6117. /* In case you want to provide your own memory allocating routines, */
  6118. /* use @FT_New_Library instead, followed by a call to */
  6119. /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
  6120. /* */
  6121. /* For multi-threading applications each thread should have its own */
  6122. /* FT_Library object. */
  6123. /* */
  6124. FT_EXPORT( FT_Error )
  6125. FT_Init_FreeType( FT_Library *alibrary );
  6126. /*************************************************************************/
  6127. /* */
  6128. /* <Function> */
  6129. /* FT_Done_FreeType */
  6130. /* */
  6131. /* <Description> */
  6132. /* Destroy a given FreeType library object and all of its children, */
  6133. /* including resources, drivers, faces, sizes, etc. */
  6134. /* */
  6135. /* <Input> */
  6136. /* library :: A handle to the target library object. */
  6137. /* */
  6138. /* <Return> */
  6139. /* FreeType error code. 0~means success. */
  6140. /* */
  6141. FT_EXPORT( FT_Error )
  6142. FT_Done_FreeType( FT_Library library );
  6143. /*************************************************************************/
  6144. /* */
  6145. /* <Enum> */
  6146. /* FT_OPEN_XXX */
  6147. /* */
  6148. /* <Description> */
  6149. /* A list of bit-field constants used within the `flags' field of the */
  6150. /* @FT_Open_Args structure. */
  6151. /* */
  6152. /* <Values> */
  6153. /* FT_OPEN_MEMORY :: This is a memory-based stream. */
  6154. /* */
  6155. /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
  6156. /* */
  6157. /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
  6158. /* name. */
  6159. /* */
  6160. /* FT_OPEN_DRIVER :: Use the `driver' field. */
  6161. /* */
  6162. /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
  6163. /* */
  6164. /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
  6165. /* */
  6166. /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
  6167. /* */
  6168. /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
  6169. /* */
  6170. /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
  6171. /* */
  6172. /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
  6173. /* */
  6174. /* <Note> */
  6175. /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
  6176. /* flags are mutually exclusive. */
  6177. /* */
  6178. #define FT_OPEN_MEMORY 0x1
  6179. #define FT_OPEN_STREAM 0x2
  6180. #define FT_OPEN_PATHNAME 0x4
  6181. #define FT_OPEN_DRIVER 0x8
  6182. #define FT_OPEN_PARAMS 0x10
  6183. #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
  6184. #define ft_open_stream FT_OPEN_STREAM /* deprecated */
  6185. #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
  6186. #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
  6187. #define ft_open_params FT_OPEN_PARAMS /* deprecated */
  6188. /*************************************************************************/
  6189. /* */
  6190. /* <Struct> */
  6191. /* FT_Parameter */
  6192. /* */
  6193. /* <Description> */
  6194. /* A simple structure used to pass more or less generic parameters to */
  6195. /* @FT_Open_Face. */
  6196. /* */
  6197. /* <Fields> */
  6198. /* tag :: A four-byte identification tag. */
  6199. /* */
  6200. /* data :: A pointer to the parameter data. */
  6201. /* */
  6202. /* <Note> */
  6203. /* The ID and function of parameters are driver-specific. See the */
  6204. /* various FT_PARAM_TAG_XXX flags for more information. */
  6205. /* */
  6206. typedef struct FT_Parameter_
  6207. {
  6208. FT_ULong tag;
  6209. FT_Pointer data;
  6210. } FT_Parameter;
  6211. /*************************************************************************/
  6212. /* */
  6213. /* <Struct> */
  6214. /* FT_Open_Args */
  6215. /* */
  6216. /* <Description> */
  6217. /* A structure used to indicate how to open a new font file or */
  6218. /* stream. A pointer to such a structure can be used as a parameter */
  6219. /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
  6220. /* */
  6221. /* <Fields> */
  6222. /* flags :: A set of bit flags indicating how to use the */
  6223. /* structure. */
  6224. /* */
  6225. /* memory_base :: The first byte of the file in memory. */
  6226. /* */
  6227. /* memory_size :: The size in bytes of the file in memory. */
  6228. /* */
  6229. /* pathname :: A pointer to an 8-bit file pathname. */
  6230. /* */
  6231. /* stream :: A handle to a source stream object. */
  6232. /* */
  6233. /* driver :: This field is exclusively used by @FT_Open_Face; */
  6234. /* it simply specifies the font driver to use to open */
  6235. /* the face. If set to~0, FreeType tries to load the */
  6236. /* face with each one of the drivers in its list. */
  6237. /* */
  6238. /* num_params :: The number of extra parameters. */
  6239. /* */
  6240. /* params :: Extra parameters passed to the font driver when */
  6241. /* opening a new face. */
  6242. /* */
  6243. /* <Note> */
  6244. /* The stream type is determined by the contents of `flags' which */
  6245. /* are tested in the following order by @FT_Open_Face: */
  6246. /* */
  6247. /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
  6248. /* memory file of `memory_size' bytes, located at `memory_address'. */
  6249. /* The data are are not copied, and the client is responsible for */
  6250. /* releasing and destroying them _after_ the corresponding call to */
  6251. /* @FT_Done_Face. */
  6252. /* */
  6253. /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
  6254. /* custom input stream `stream' is used. */
  6255. /* */
  6256. /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
  6257. /* is a normal file and use `pathname' to open it. */
  6258. /* */
  6259. /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
  6260. /* open the file with the driver whose handler is in `driver'. */
  6261. /* */
  6262. /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
  6263. /* `num_params' and `params' is used. They are ignored otherwise. */
  6264. /* */
  6265. /* Ideally, both the `pathname' and `params' fields should be tagged */
  6266. /* as `const'; this is missing for API backwards compatibility. In */
  6267. /* other words, applications should treat them as read-only. */
  6268. /* */
  6269. typedef struct FT_Open_Args_
  6270. {
  6271. FT_UInt flags;
  6272. const FT_Byte* memory_base;
  6273. FT_Long memory_size;
  6274. FT_String* pathname;
  6275. FT_Stream stream;
  6276. FT_Module driver;
  6277. FT_Int num_params;
  6278. FT_Parameter* params;
  6279. } FT_Open_Args;
  6280. /*************************************************************************/
  6281. /* */
  6282. /* <Function> */
  6283. /* FT_New_Face */
  6284. /* */
  6285. /* <Description> */
  6286. /* This function calls @FT_Open_Face to open a font by its pathname. */
  6287. /* */
  6288. /* <InOut> */
  6289. /* library :: A handle to the library resource. */
  6290. /* */
  6291. /* <Input> */
  6292. /* pathname :: A path to the font file. */
  6293. /* */
  6294. /* face_index :: The index of the face within the font. The first */
  6295. /* face has index~0. */
  6296. /* */
  6297. /* <Output> */
  6298. /* aface :: A handle to a new face object. If `face_index' is */
  6299. /* greater than or equal to zero, it must be non-NULL. */
  6300. /* See @FT_Open_Face for more details. */
  6301. /* */
  6302. /* <Return> */
  6303. /* FreeType error code. 0~means success. */
  6304. /* */
  6305. FT_EXPORT( FT_Error )
  6306. FT_New_Face( FT_Library library,
  6307. const char* filepathname,
  6308. FT_Long face_index,
  6309. FT_Face *aface );
  6310. /*************************************************************************/
  6311. /* */
  6312. /* <Function> */
  6313. /* FT_New_Memory_Face */
  6314. /* */
  6315. /* <Description> */
  6316. /* This function calls @FT_Open_Face to open a font which has been */
  6317. /* loaded into memory. */
  6318. /* */
  6319. /* <InOut> */
  6320. /* library :: A handle to the library resource. */
  6321. /* */
  6322. /* <Input> */
  6323. /* file_base :: A pointer to the beginning of the font data. */
  6324. /* */
  6325. /* file_size :: The size of the memory chunk used by the font data. */
  6326. /* */
  6327. /* face_index :: The index of the face within the font. The first */
  6328. /* face has index~0. */
  6329. /* */
  6330. /* <Output> */
  6331. /* aface :: A handle to a new face object. If `face_index' is */
  6332. /* greater than or equal to zero, it must be non-NULL. */
  6333. /* See @FT_Open_Face for more details. */
  6334. /* */
  6335. /* <Return> */
  6336. /* FreeType error code. 0~means success. */
  6337. /* */
  6338. /* <Note> */
  6339. /* You must not deallocate the memory before calling @FT_Done_Face. */
  6340. /* */
  6341. FT_EXPORT( FT_Error )
  6342. FT_New_Memory_Face( FT_Library library,
  6343. const FT_Byte* file_base,
  6344. FT_Long file_size,
  6345. FT_Long face_index,
  6346. FT_Face *aface );
  6347. /*************************************************************************/
  6348. /* */
  6349. /* <Function> */
  6350. /* FT_Open_Face */
  6351. /* */
  6352. /* <Description> */
  6353. /* Create a face object from a given resource described by */
  6354. /* @FT_Open_Args. */
  6355. /* */
  6356. /* <InOut> */
  6357. /* library :: A handle to the library resource. */
  6358. /* */
  6359. /* <Input> */
  6360. /* args :: A pointer to an `FT_Open_Args' structure which must */
  6361. /* be filled by the caller. */
  6362. /* */
  6363. /* face_index :: The index of the face within the font. The first */
  6364. /* face has index~0. */
  6365. /* */
  6366. /* <Output> */
  6367. /* aface :: A handle to a new face object. If `face_index' is */
  6368. /* greater than or equal to zero, it must be non-NULL. */
  6369. /* See note below. */
  6370. /* */
  6371. /* <Return> */
  6372. /* FreeType error code. 0~means success. */
  6373. /* */
  6374. /* <Note> */
  6375. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  6376. /* slot for the face object which can be accessed directly through */
  6377. /* `face->glyph'. */
  6378. /* */
  6379. /* FT_Open_Face can be used to quickly check whether the font */
  6380. /* format of a given font resource is supported by FreeType. If the */
  6381. /* `face_index' field is negative, the function's return value is~0 */
  6382. /* if the font format is recognized, or non-zero otherwise; */
  6383. /* the function returns a more or less empty face handle in `*aface' */
  6384. /* (if `aface' isn't NULL). The only useful field in this special */
  6385. /* case is `face->num_faces' which gives the number of faces within */
  6386. /* the font file. After examination, the returned @FT_Face structure */
  6387. /* should be deallocated with a call to @FT_Done_Face. */
  6388. /* */
  6389. /* Each new face object created with this function also owns a */
  6390. /* default @FT_Size object, accessible as `face->size'. */
  6391. /* */
  6392. /* One @FT_Library instance can have multiple face objects, this is, */
  6393. /* @FT_Open_Face and its siblings can be called multiple times using */
  6394. /* the same `library' argument. */
  6395. /* */
  6396. /* See the discussion of reference counters in the description of */
  6397. /* @FT_Reference_Face. */
  6398. /* */
  6399. FT_EXPORT( FT_Error )
  6400. FT_Open_Face( FT_Library library,
  6401. const FT_Open_Args* args,
  6402. FT_Long face_index,
  6403. FT_Face *aface );
  6404. /*************************************************************************/
  6405. /* */
  6406. /* <Function> */
  6407. /* FT_Attach_File */
  6408. /* */
  6409. /* <Description> */
  6410. /* This function calls @FT_Attach_Stream to attach a file. */
  6411. /* */
  6412. /* <InOut> */
  6413. /* face :: The target face object. */
  6414. /* */
  6415. /* <Input> */
  6416. /* filepathname :: The pathname. */
  6417. /* */
  6418. /* <Return> */
  6419. /* FreeType error code. 0~means success. */
  6420. /* */
  6421. FT_EXPORT( FT_Error )
  6422. FT_Attach_File( FT_Face face,
  6423. const char* filepathname );
  6424. /*************************************************************************/
  6425. /* */
  6426. /* <Function> */
  6427. /* FT_Attach_Stream */
  6428. /* */
  6429. /* <Description> */
  6430. /* `Attach' data to a face object. Normally, this is used to read */
  6431. /* additional information for the face object. For example, you can */
  6432. /* attach an AFM file that comes with a Type~1 font to get the */
  6433. /* kerning values and other metrics. */
  6434. /* */
  6435. /* <InOut> */
  6436. /* face :: The target face object. */
  6437. /* */
  6438. /* <Input> */
  6439. /* parameters :: A pointer to @FT_Open_Args which must be filled by */
  6440. /* the caller. */
  6441. /* */
  6442. /* <Return> */
  6443. /* FreeType error code. 0~means success. */
  6444. /* */
  6445. /* <Note> */
  6446. /* The meaning of the `attach' (i.e., what really happens when the */
  6447. /* new file is read) is not fixed by FreeType itself. It really */
  6448. /* depends on the font format (and thus the font driver). */
  6449. /* */
  6450. /* Client applications are expected to know what they are doing */
  6451. /* when invoking this function. Most drivers simply do not implement */
  6452. /* file attachments. */
  6453. /* */
  6454. FT_EXPORT( FT_Error )
  6455. FT_Attach_Stream( FT_Face face,
  6456. FT_Open_Args* parameters );
  6457. /*************************************************************************/
  6458. /* */
  6459. /* <Function> */
  6460. /* FT_Reference_Face */
  6461. /* */
  6462. /* <Description> */
  6463. /* A counter gets initialized to~1 at the time an @FT_Face structure */
  6464. /* is created. This function increments the counter. @FT_Done_Face */
  6465. /* then only destroys a face if the counter is~1, otherwise it simply */
  6466. /* decrements the counter. */
  6467. /* */
  6468. /* This function helps in managing life-cycles of structures which */
  6469. /* reference @FT_Face objects. */
  6470. /* */
  6471. /* <Input> */
  6472. /* face :: A handle to a target face object. */
  6473. /* */
  6474. /* <Return> */
  6475. /* FreeType error code. 0~means success. */
  6476. /* */
  6477. /* <Since> */
  6478. /* 2.4.2 */
  6479. /* */
  6480. FT_EXPORT( FT_Error )
  6481. FT_Reference_Face( FT_Face face );
  6482. /*************************************************************************/
  6483. /* */
  6484. /* <Function> */
  6485. /* FT_Done_Face */
  6486. /* */
  6487. /* <Description> */
  6488. /* Discard a given face object, as well as all of its child slots and */
  6489. /* sizes. */
  6490. /* */
  6491. /* <Input> */
  6492. /* face :: A handle to a target face object. */
  6493. /* */
  6494. /* <Return> */
  6495. /* FreeType error code. 0~means success. */
  6496. /* */
  6497. /* <Note> */
  6498. /* See the discussion of reference counters in the description of */
  6499. /* @FT_Reference_Face. */
  6500. /* */
  6501. FT_EXPORT( FT_Error )
  6502. FT_Done_Face( FT_Face face );
  6503. /*************************************************************************/
  6504. /* */
  6505. /* <Function> */
  6506. /* FT_Select_Size */
  6507. /* */
  6508. /* <Description> */
  6509. /* Select a bitmap strike. */
  6510. /* */
  6511. /* <InOut> */
  6512. /* face :: A handle to a target face object. */
  6513. /* */
  6514. /* <Input> */
  6515. /* strike_index :: The index of the bitmap strike in the */
  6516. /* `available_sizes' field of @FT_FaceRec structure. */
  6517. /* */
  6518. /* <Return> */
  6519. /* FreeType error code. 0~means success. */
  6520. /* */
  6521. FT_EXPORT( FT_Error )
  6522. FT_Select_Size( FT_Face face,
  6523. FT_Int strike_index );
  6524. /*************************************************************************/
  6525. /* */
  6526. /* <Enum> */
  6527. /* FT_Size_Request_Type */
  6528. /* */
  6529. /* <Description> */
  6530. /* An enumeration type that lists the supported size request types. */
  6531. /* */
  6532. /* <Values> */
  6533. /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
  6534. /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
  6535. /* used to determine both scaling values. */
  6536. /* */
  6537. /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
  6538. /* The real dimension. The sum of the the `ascender' and (minus */
  6539. /* of) the `descender' fields of @FT_FaceRec are used to determine */
  6540. /* both scaling values. */
  6541. /* */
  6542. /* FT_SIZE_REQUEST_TYPE_BBOX :: */
  6543. /* The font bounding box. The width and height of the `bbox' field */
  6544. /* of @FT_FaceRec are used to determine the horizontal and vertical */
  6545. /* scaling value, respectively. */
  6546. /* */
  6547. /* FT_SIZE_REQUEST_TYPE_CELL :: */
  6548. /* The `max_advance_width' field of @FT_FaceRec is used to */
  6549. /* determine the horizontal scaling value; the vertical scaling */
  6550. /* value is determined the same way as */
  6551. /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
  6552. /* values are set to the smaller one. This type is useful if you */
  6553. /* want to specify the font size for, say, a window of a given */
  6554. /* dimension and 80x24 cells. */
  6555. /* */
  6556. /* FT_SIZE_REQUEST_TYPE_SCALES :: */
  6557. /* Specify the scaling values directly. */
  6558. /* */
  6559. /* <Note> */
  6560. /* The above descriptions only apply to scalable formats. For bitmap */
  6561. /* formats, the behaviour is up to the driver. */
  6562. /* */
  6563. /* See the note section of @FT_Size_Metrics if you wonder how size */
  6564. /* requesting relates to scaling values. */
  6565. /* */
  6566. typedef enum FT_Size_Request_Type_
  6567. {
  6568. FT_SIZE_REQUEST_TYPE_NOMINAL,
  6569. FT_SIZE_REQUEST_TYPE_REAL_DIM,
  6570. FT_SIZE_REQUEST_TYPE_BBOX,
  6571. FT_SIZE_REQUEST_TYPE_CELL,
  6572. FT_SIZE_REQUEST_TYPE_SCALES,
  6573. FT_SIZE_REQUEST_TYPE_MAX
  6574. } FT_Size_Request_Type;
  6575. /*************************************************************************/
  6576. /* */
  6577. /* <Struct> */
  6578. /* FT_Size_RequestRec */
  6579. /* */
  6580. /* <Description> */
  6581. /* A structure used to model a size request. */
  6582. /* */
  6583. /* <Fields> */
  6584. /* type :: See @FT_Size_Request_Type. */
  6585. /* */
  6586. /* width :: The desired width. */
  6587. /* */
  6588. /* height :: The desired height. */
  6589. /* */
  6590. /* horiResolution :: The horizontal resolution. If set to zero, */
  6591. /* `width' is treated as a 26.6 fractional pixel */
  6592. /* value. */
  6593. /* */
  6594. /* vertResolution :: The vertical resolution. If set to zero, */
  6595. /* `height' is treated as a 26.6 fractional pixel */
  6596. /* value. */
  6597. /* */
  6598. /* <Note> */
  6599. /* If `width' is zero, then the horizontal scaling value is set equal */
  6600. /* to the vertical scaling value, and vice versa. */
  6601. /* */
  6602. typedef struct FT_Size_RequestRec_
  6603. {
  6604. FT_Size_Request_Type type;
  6605. FT_Long width;
  6606. FT_Long height;
  6607. FT_UInt horiResolution;
  6608. FT_UInt vertResolution;
  6609. } FT_Size_RequestRec;
  6610. /*************************************************************************/
  6611. /* */
  6612. /* <Struct> */
  6613. /* FT_Size_Request */
  6614. /* */
  6615. /* <Description> */
  6616. /* A handle to a size request structure. */
  6617. /* */
  6618. typedef struct FT_Size_RequestRec_ *FT_Size_Request;
  6619. /*************************************************************************/
  6620. /* */
  6621. /* <Function> */
  6622. /* FT_Request_Size */
  6623. /* */
  6624. /* <Description> */
  6625. /* Resize the scale of the active @FT_Size object in a face. */
  6626. /* */
  6627. /* <InOut> */
  6628. /* face :: A handle to a target face object. */
  6629. /* */
  6630. /* <Input> */
  6631. /* req :: A pointer to a @FT_Size_RequestRec. */
  6632. /* */
  6633. /* <Return> */
  6634. /* FreeType error code. 0~means success. */
  6635. /* */
  6636. /* <Note> */
  6637. /* Although drivers may select the bitmap strike matching the */
  6638. /* request, you should not rely on this if you intend to select a */
  6639. /* particular bitmap strike. Use @FT_Select_Size instead in that */
  6640. /* case. */
  6641. /* */
  6642. /* The relation between the requested size and the resulting glyph */
  6643. /* size is dependent entirely on how the size is defined in the */
  6644. /* source face. The font designer chooses the final size of each */
  6645. /* glyph relative to this size. For more information refer to */
  6646. /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */
  6647. /* */
  6648. FT_EXPORT( FT_Error )
  6649. FT_Request_Size( FT_Face face,
  6650. FT_Size_Request req );
  6651. /*************************************************************************/
  6652. /* */
  6653. /* <Function> */
  6654. /* FT_Set_Char_Size */
  6655. /* */
  6656. /* <Description> */
  6657. /* This function calls @FT_Request_Size to request the nominal size */
  6658. /* (in points). */
  6659. /* */
  6660. /* <InOut> */
  6661. /* face :: A handle to a target face object. */
  6662. /* */
  6663. /* <Input> */
  6664. /* char_width :: The nominal width, in 26.6 fractional points. */
  6665. /* */
  6666. /* char_height :: The nominal height, in 26.6 fractional points. */
  6667. /* */
  6668. /* horz_resolution :: The horizontal resolution in dpi. */
  6669. /* */
  6670. /* vert_resolution :: The vertical resolution in dpi. */
  6671. /* */
  6672. /* <Return> */
  6673. /* FreeType error code. 0~means success. */
  6674. /* */
  6675. /* <Note> */
  6676. /* If either the character width or height is zero, it is set equal */
  6677. /* to the other value. */
  6678. /* */
  6679. /* If either the horizontal or vertical resolution is zero, it is set */
  6680. /* equal to the other value. */
  6681. /* */
  6682. /* A character width or height smaller than 1pt is set to 1pt; if */
  6683. /* both resolution values are zero, they are set to 72dpi. */
  6684. /* */
  6685. /* Don't use this function if you are using the FreeType cache API. */
  6686. /* */
  6687. FT_EXPORT( FT_Error )
  6688. FT_Set_Char_Size( FT_Face face,
  6689. FT_F26Dot6 char_width,
  6690. FT_F26Dot6 char_height,
  6691. FT_UInt horz_resolution,
  6692. FT_UInt vert_resolution );
  6693. /*************************************************************************/
  6694. /* */
  6695. /* <Function> */
  6696. /* FT_Set_Pixel_Sizes */
  6697. /* */
  6698. /* <Description> */
  6699. /* This function calls @FT_Request_Size to request the nominal size */
  6700. /* (in pixels). */
  6701. /* */
  6702. /* <InOut> */
  6703. /* face :: A handle to the target face object. */
  6704. /* */
  6705. /* <Input> */
  6706. /* pixel_width :: The nominal width, in pixels. */
  6707. /* */
  6708. /* pixel_height :: The nominal height, in pixels. */
  6709. /* */
  6710. /* <Return> */
  6711. /* FreeType error code. 0~means success. */
  6712. /* */
  6713. /* <Note> */
  6714. /* You should not rely on the resulting glyphs matching, or being */
  6715. /* constrained, to this pixel size. Refer to @FT_Request_Size to */
  6716. /* understand how requested sizes relate to actual sizes. */
  6717. /* */
  6718. FT_EXPORT( FT_Error )
  6719. FT_Set_Pixel_Sizes( FT_Face face,
  6720. FT_UInt pixel_width,
  6721. FT_UInt pixel_height );
  6722. /*************************************************************************/
  6723. /* */
  6724. /* <Function> */
  6725. /* FT_Load_Glyph */
  6726. /* */
  6727. /* <Description> */
  6728. /* A function used to load a single glyph into the glyph slot of a */
  6729. /* face object. */
  6730. /* */
  6731. /* <InOut> */
  6732. /* face :: A handle to the target face object where the glyph */
  6733. /* is loaded. */
  6734. /* */
  6735. /* <Input> */
  6736. /* glyph_index :: The index of the glyph in the font file. For */
  6737. /* CID-keyed fonts (either in PS or in CFF format) */
  6738. /* this argument specifies the CID value. */
  6739. /* */
  6740. /* load_flags :: A flag indicating what to load for this glyph. The */
  6741. /* @FT_LOAD_XXX constants can be used to control the */
  6742. /* glyph loading process (e.g., whether the outline */
  6743. /* should be scaled, whether to load bitmaps or not, */
  6744. /* whether to hint the outline, etc). */
  6745. /* */
  6746. /* <Return> */
  6747. /* FreeType error code. 0~means success. */
  6748. /* */
  6749. /* <Note> */
  6750. /* The loaded glyph may be transformed. See @FT_Set_Transform for */
  6751. /* the details. */
  6752. /* */
  6753. /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
  6754. /* returned for invalid CID values (this is, for CID values which */
  6755. /* don't have a corresponding glyph in the font). See the discussion */
  6756. /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
  6757. /* */
  6758. FT_EXPORT( FT_Error )
  6759. FT_Load_Glyph( FT_Face face,
  6760. FT_UInt glyph_index,
  6761. FT_Int32 load_flags );
  6762. /*************************************************************************/
  6763. /* */
  6764. /* <Function> */
  6765. /* FT_Load_Char */
  6766. /* */
  6767. /* <Description> */
  6768. /* A function used to load a single glyph into the glyph slot of a */
  6769. /* face object, according to its character code. */
  6770. /* */
  6771. /* <InOut> */
  6772. /* face :: A handle to a target face object where the glyph */
  6773. /* is loaded. */
  6774. /* */
  6775. /* <Input> */
  6776. /* char_code :: The glyph's character code, according to the */
  6777. /* current charmap used in the face. */
  6778. /* */
  6779. /* load_flags :: A flag indicating what to load for this glyph. The */
  6780. /* @FT_LOAD_XXX constants can be used to control the */
  6781. /* glyph loading process (e.g., whether the outline */
  6782. /* should be scaled, whether to load bitmaps or not, */
  6783. /* whether to hint the outline, etc). */
  6784. /* */
  6785. /* <Return> */
  6786. /* FreeType error code. 0~means success. */
  6787. /* */
  6788. /* <Note> */
  6789. /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
  6790. /* */
  6791. FT_EXPORT( FT_Error )
  6792. FT_Load_Char( FT_Face face,
  6793. FT_ULong char_code,
  6794. FT_Int32 load_flags );
  6795. /*************************************************************************
  6796. *
  6797. * @enum:
  6798. * FT_LOAD_XXX
  6799. *
  6800. * @description:
  6801. * A list of bit-field constants used with @FT_Load_Glyph to indicate
  6802. * what kind of operations to perform during glyph loading.
  6803. *
  6804. * @values:
  6805. * FT_LOAD_DEFAULT ::
  6806. * Corresponding to~0, this value is used as the default glyph load
  6807. * operation. In this case, the following happens:
  6808. *
  6809. * 1. FreeType looks for a bitmap for the glyph corresponding to the
  6810. * face's current size. If one is found, the function returns.
  6811. * The bitmap data can be accessed from the glyph slot (see note
  6812. * below).
  6813. *
  6814. * 2. If no embedded bitmap is searched or found, FreeType looks for a
  6815. * scalable outline. If one is found, it is loaded from the font
  6816. * file, scaled to device pixels, then `hinted' to the pixel grid
  6817. * in order to optimize it. The outline data can be accessed from
  6818. * the glyph slot (see note below).
  6819. *
  6820. * Note that by default, the glyph loader doesn't render outlines into
  6821. * bitmaps. The following flags are used to modify this default
  6822. * behaviour to more specific and useful cases.
  6823. *
  6824. * FT_LOAD_NO_SCALE ::
  6825. * Don't scale the loaded outline glyph but keep it in font units.
  6826. *
  6827. * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
  6828. * unsets @FT_LOAD_RENDER.
  6829. *
  6830. * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using
  6831. * FT_LOAD_NO_SCALE usually yields meaningless outlines because the
  6832. * subglyphs must be scaled and positioned with hinting instructions.
  6833. * This can be solved by loading the font without FT_LOAD_NO_SCALE and
  6834. * setting the character size to `font->units_per_EM'.
  6835. *
  6836. * FT_LOAD_NO_HINTING ::
  6837. * Disable hinting. This generally generates `blurrier' bitmap glyphs
  6838. * when the glyph are rendered in any of the anti-aliased modes. See
  6839. * also the note below.
  6840. *
  6841. * This flag is implied by @FT_LOAD_NO_SCALE.
  6842. *
  6843. * FT_LOAD_RENDER ::
  6844. * Call @FT_Render_Glyph after the glyph is loaded. By default, the
  6845. * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
  6846. * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
  6847. *
  6848. * This flag is unset by @FT_LOAD_NO_SCALE.
  6849. *
  6850. * FT_LOAD_NO_BITMAP ::
  6851. * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
  6852. * flag.
  6853. *
  6854. * @FT_LOAD_NO_SCALE always sets this flag.
  6855. *
  6856. * FT_LOAD_VERTICAL_LAYOUT ::
  6857. * Load the glyph for vertical text layout. In particular, the
  6858. * `advance' value in the @FT_GlyphSlotRec structure is set to the
  6859. * `vertAdvance' value of the `metrics' field.
  6860. *
  6861. * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use
  6862. * this flag currently. Reason is that in this case vertical metrics
  6863. * get synthesized, and those values are not always consistent across
  6864. * various font formats.
  6865. *
  6866. * FT_LOAD_FORCE_AUTOHINT ::
  6867. * Indicates that the auto-hinter is preferred over the font's native
  6868. * hinter. See also the note below.
  6869. *
  6870. * FT_LOAD_CROP_BITMAP ::
  6871. * Indicates that the font driver should crop the loaded bitmap glyph
  6872. * (i.e., remove all space around its black bits). Not all drivers
  6873. * implement this.
  6874. *
  6875. * FT_LOAD_PEDANTIC ::
  6876. * Indicates that the font driver should perform pedantic verifications
  6877. * during glyph loading. This is mostly used to detect broken glyphs
  6878. * in fonts. By default, FreeType tries to handle broken fonts also.
  6879. *
  6880. * In particular, errors from the TrueType bytecode engine are not
  6881. * passed to the application if this flag is not set; this might
  6882. * result in partially hinted or distorted glyphs in case a glyph's
  6883. * bytecode is buggy.
  6884. *
  6885. * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
  6886. * Ignored. Deprecated.
  6887. *
  6888. * FT_LOAD_NO_RECURSE ::
  6889. * This flag is only used internally. It merely indicates that the
  6890. * font driver should not load composite glyphs recursively. Instead,
  6891. * it should set the `num_subglyph' and `subglyphs' values of the
  6892. * glyph slot accordingly, and set `glyph->format' to
  6893. * @FT_GLYPH_FORMAT_COMPOSITE.
  6894. *
  6895. * The description of sub-glyphs is not available to client
  6896. * applications for now.
  6897. *
  6898. * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
  6899. *
  6900. * FT_LOAD_IGNORE_TRANSFORM ::
  6901. * Indicates that the transform matrix set by @FT_Set_Transform should
  6902. * be ignored.
  6903. *
  6904. * FT_LOAD_MONOCHROME ::
  6905. * This flag is used with @FT_LOAD_RENDER to indicate that you want to
  6906. * render an outline glyph to a 1-bit monochrome bitmap glyph, with
  6907. * 8~pixels packed into each byte of the bitmap data.
  6908. *
  6909. * Note that this has no effect on the hinting algorithm used. You
  6910. * should rather use @FT_LOAD_TARGET_MONO so that the
  6911. * monochrome-optimized hinting algorithm is used.
  6912. *
  6913. * FT_LOAD_LINEAR_DESIGN ::
  6914. * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
  6915. * fields of @FT_GlyphSlotRec should be kept in font units. See
  6916. * @FT_GlyphSlotRec for details.
  6917. *
  6918. * FT_LOAD_NO_AUTOHINT ::
  6919. * Disable auto-hinter. See also the note below.
  6920. *
  6921. * @note:
  6922. * By default, hinting is enabled and the font's native hinter (see
  6923. * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
  6924. * disable hinting by setting @FT_LOAD_NO_HINTING or change the
  6925. * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
  6926. * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
  6927. * used at all.
  6928. *
  6929. * See the description of @FT_FACE_FLAG_TRICKY for a special exception
  6930. * (affecting only a handful of Asian fonts).
  6931. *
  6932. * Besides deciding which hinter to use, you can also decide which
  6933. * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
  6934. *
  6935. * Note that the auto-hinter needs a valid Unicode cmap (either a native
  6936. * one or synthesized by FreeType) for producing correct results. If a
  6937. * font provides an incorrect mapping (for example, assigning the
  6938. * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
  6939. * mathematical integral sign), the auto-hinter might produce useless
  6940. * results.
  6941. *
  6942. */
  6943. #define FT_LOAD_DEFAULT 0x0
  6944. #define FT_LOAD_NO_SCALE ( 1L << 0 )
  6945. #define FT_LOAD_NO_HINTING ( 1L << 1 )
  6946. #define FT_LOAD_RENDER ( 1L << 2 )
  6947. #define FT_LOAD_NO_BITMAP ( 1L << 3 )
  6948. #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
  6949. #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
  6950. #define FT_LOAD_CROP_BITMAP ( 1L << 6 )
  6951. #define FT_LOAD_PEDANTIC ( 1L << 7 )
  6952. #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
  6953. #define FT_LOAD_NO_RECURSE ( 1L << 10 )
  6954. #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
  6955. #define FT_LOAD_MONOCHROME ( 1L << 12 )
  6956. #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
  6957. #define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
  6958. /* */
  6959. /* used internally only by certain font drivers! */
  6960. #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
  6961. #define FT_LOAD_SBITS_ONLY ( 1L << 14 )
  6962. /**************************************************************************
  6963. *
  6964. * @enum:
  6965. * FT_LOAD_TARGET_XXX
  6966. *
  6967. * @description:
  6968. * A list of values that are used to select a specific hinting algorithm
  6969. * to use by the hinter. You should OR one of these values to your
  6970. * `load_flags' when calling @FT_Load_Glyph.
  6971. *
  6972. * Note that font's native hinters may ignore the hinting algorithm you
  6973. * have specified (e.g., the TrueType bytecode interpreter). You can set
  6974. * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
  6975. *
  6976. * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
  6977. * always implies @FT_LOAD_FORCE_AUTOHINT.
  6978. *
  6979. * @values:
  6980. * FT_LOAD_TARGET_NORMAL ::
  6981. * This corresponds to the default hinting algorithm, optimized for
  6982. * standard gray-level rendering. For monochrome output, use
  6983. * @FT_LOAD_TARGET_MONO instead.
  6984. *
  6985. * FT_LOAD_TARGET_LIGHT ::
  6986. * A lighter hinting algorithm for non-monochrome modes. Many
  6987. * generated glyphs are more fuzzy but better resemble its original
  6988. * shape. A bit like rendering on Mac OS~X.
  6989. *
  6990. * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
  6991. *
  6992. * FT_LOAD_TARGET_MONO ::
  6993. * Strong hinting algorithm that should only be used for monochrome
  6994. * output. The result is probably unpleasant if the glyph is rendered
  6995. * in non-monochrome modes.
  6996. *
  6997. * FT_LOAD_TARGET_LCD ::
  6998. * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
  6999. * decimated LCD displays.
  7000. *
  7001. * FT_LOAD_TARGET_LCD_V ::
  7002. * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
  7003. * decimated LCD displays.
  7004. *
  7005. * @note:
  7006. * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
  7007. * `load_flags'. They can't be ORed.
  7008. *
  7009. * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
  7010. * corresponding mode (i.e., the mode which matches the used algorithm
  7011. * best). An exeption is FT_LOAD_TARGET_MONO since it implies
  7012. * @FT_LOAD_MONOCHROME.
  7013. *
  7014. * You can use a hinting algorithm that doesn't correspond to the same
  7015. * rendering mode. As an example, it is possible to use the `light'
  7016. * hinting algorithm and have the results rendered in horizontal LCD
  7017. * pixel mode, with code like
  7018. *
  7019. * {
  7020. * FT_Load_Glyph( face, glyph_index,
  7021. * load_flags | FT_LOAD_TARGET_LIGHT );
  7022. *
  7023. * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
  7024. * }
  7025. *
  7026. */
  7027. #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
  7028. #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
  7029. #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
  7030. #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
  7031. #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
  7032. #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
  7033. /**************************************************************************
  7034. *
  7035. * @macro:
  7036. * FT_LOAD_TARGET_MODE
  7037. *
  7038. * @description:
  7039. * Return the @FT_Render_Mode corresponding to a given
  7040. * @FT_LOAD_TARGET_XXX value.
  7041. *
  7042. */
  7043. #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
  7044. /*************************************************************************/
  7045. /* */
  7046. /* <Function> */
  7047. /* FT_Set_Transform */
  7048. /* */
  7049. /* <Description> */
  7050. /* A function used to set the transformation that is applied to glyph */
  7051. /* images when they are loaded into a glyph slot through */
  7052. /* @FT_Load_Glyph. */
  7053. /* */
  7054. /* <InOut> */
  7055. /* face :: A handle to the source face object. */
  7056. /* */
  7057. /* <Input> */
  7058. /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
  7059. /* the identity matrix. */
  7060. /* delta :: A pointer to the translation vector. Use~0 for the null */
  7061. /* vector. */
  7062. /* */
  7063. /* <Note> */
  7064. /* The transformation is only applied to scalable image formats after */
  7065. /* the glyph has been loaded. It means that hinting is unaltered by */
  7066. /* the transformation and is performed on the character size given in */
  7067. /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
  7068. /* */
  7069. /* Note that this also transforms the `face.glyph.advance' field, but */
  7070. /* *not* the values in `face.glyph.metrics'. */
  7071. /* */
  7072. FT_EXPORT( void )
  7073. FT_Set_Transform( FT_Face face,
  7074. FT_Matrix* matrix,
  7075. FT_Vector* delta );
  7076. /*************************************************************************/
  7077. /* */
  7078. /* <Enum> */
  7079. /* FT_Render_Mode */
  7080. /* */
  7081. /* <Description> */
  7082. /* An enumeration type that lists the render modes supported by */
  7083. /* FreeType~2. Each mode corresponds to a specific type of scanline */
  7084. /* conversion performed on the outline. */
  7085. /* */
  7086. /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
  7087. /* field in the @FT_GlyphSlotRec structure gives the format of the */
  7088. /* returned bitmap. */
  7089. /* */
  7090. /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
  7091. /* */
  7092. /* <Values> */
  7093. /* FT_RENDER_MODE_NORMAL :: */
  7094. /* This is the default render mode; it corresponds to 8-bit */
  7095. /* anti-aliased bitmaps. */
  7096. /* */
  7097. /* FT_RENDER_MODE_LIGHT :: */
  7098. /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
  7099. /* defined as a separate value because render modes are also used */
  7100. /* indirectly to define hinting algorithm selectors. See */
  7101. /* @FT_LOAD_TARGET_XXX for details. */
  7102. /* */
  7103. /* FT_RENDER_MODE_MONO :: */
  7104. /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
  7105. /* opacity). */
  7106. /* */
  7107. /* FT_RENDER_MODE_LCD :: */
  7108. /* This mode corresponds to horizontal RGB and BGR sub-pixel */
  7109. /* displays like LCD screens. It produces 8-bit bitmaps that are */
  7110. /* 3~times the width of the original glyph outline in pixels, and */
  7111. /* which use the @FT_PIXEL_MODE_LCD mode. */
  7112. /* */
  7113. /* FT_RENDER_MODE_LCD_V :: */
  7114. /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
  7115. /* (like PDA screens, rotated LCD displays, etc.). It produces */
  7116. /* 8-bit bitmaps that are 3~times the height of the original */
  7117. /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
  7118. /* */
  7119. /* <Note> */
  7120. /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
  7121. /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
  7122. /* (not active in the default builds). It is up to the caller to */
  7123. /* either call @FT_Library_SetLcdFilter (if available) or do the */
  7124. /* filtering itself. */
  7125. /* */
  7126. /* The selected render mode only affects vector glyphs of a font. */
  7127. /* Embedded bitmaps often have a different pixel mode like */
  7128. /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
  7129. /* them into 8-bit pixmaps. */
  7130. /* */
  7131. typedef enum FT_Render_Mode_
  7132. {
  7133. FT_RENDER_MODE_NORMAL = 0,
  7134. FT_RENDER_MODE_LIGHT,
  7135. FT_RENDER_MODE_MONO,
  7136. FT_RENDER_MODE_LCD,
  7137. FT_RENDER_MODE_LCD_V,
  7138. FT_RENDER_MODE_MAX
  7139. } FT_Render_Mode;
  7140. /*************************************************************************/
  7141. /* */
  7142. /* <Enum> */
  7143. /* ft_render_mode_xxx */
  7144. /* */
  7145. /* <Description> */
  7146. /* These constants are deprecated. Use the corresponding */
  7147. /* @FT_Render_Mode values instead. */
  7148. /* */
  7149. /* <Values> */
  7150. /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
  7151. /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
  7152. /* */
  7153. #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
  7154. #define ft_render_mode_mono FT_RENDER_MODE_MONO
  7155. /*************************************************************************/
  7156. /* */
  7157. /* <Function> */
  7158. /* FT_Render_Glyph */
  7159. /* */
  7160. /* <Description> */
  7161. /* Convert a given glyph image to a bitmap. It does so by inspecting */
  7162. /* the glyph image format, finding the relevant renderer, and */
  7163. /* invoking it. */
  7164. /* */
  7165. /* <InOut> */
  7166. /* slot :: A handle to the glyph slot containing the image to */
  7167. /* convert. */
  7168. /* */
  7169. /* <Input> */
  7170. /* render_mode :: This is the render mode used to render the glyph */
  7171. /* image into a bitmap. See @FT_Render_Mode for a */
  7172. /* list of possible values. */
  7173. /* */
  7174. /* <Return> */
  7175. /* FreeType error code. 0~means success. */
  7176. /* */
  7177. FT_EXPORT( FT_Error )
  7178. FT_Render_Glyph( FT_GlyphSlot slot,
  7179. FT_Render_Mode render_mode );
  7180. /*************************************************************************/
  7181. /* */
  7182. /* <Enum> */
  7183. /* FT_Kerning_Mode */
  7184. /* */
  7185. /* <Description> */
  7186. /* An enumeration used to specify which kerning values to return in */
  7187. /* @FT_Get_Kerning. */
  7188. /* */
  7189. /* <Values> */
  7190. /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
  7191. /* distances (value is~0). */
  7192. /* */
  7193. /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
  7194. /* distances. */
  7195. /* */
  7196. /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
  7197. /* units. */
  7198. /* */
  7199. typedef enum FT_Kerning_Mode_
  7200. {
  7201. FT_KERNING_DEFAULT = 0,
  7202. FT_KERNING_UNFITTED,
  7203. FT_KERNING_UNSCALED
  7204. } FT_Kerning_Mode;
  7205. /*************************************************************************/
  7206. /* */
  7207. /* <Const> */
  7208. /* ft_kerning_default */
  7209. /* */
  7210. /* <Description> */
  7211. /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
  7212. /* instead. */
  7213. /* */
  7214. #define ft_kerning_default FT_KERNING_DEFAULT
  7215. /*************************************************************************/
  7216. /* */
  7217. /* <Const> */
  7218. /* ft_kerning_unfitted */
  7219. /* */
  7220. /* <Description> */
  7221. /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
  7222. /* instead. */
  7223. /* */
  7224. #define ft_kerning_unfitted FT_KERNING_UNFITTED
  7225. /*************************************************************************/
  7226. /* */
  7227. /* <Const> */
  7228. /* ft_kerning_unscaled */
  7229. /* */
  7230. /* <Description> */
  7231. /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
  7232. /* instead. */
  7233. /* */
  7234. #define ft_kerning_unscaled FT_KERNING_UNSCALED
  7235. /*************************************************************************/
  7236. /* */
  7237. /* <Function> */
  7238. /* FT_Get_Kerning */
  7239. /* */
  7240. /* <Description> */
  7241. /* Return the kerning vector between two glyphs of a same face. */
  7242. /* */
  7243. /* <Input> */
  7244. /* face :: A handle to a source face object. */
  7245. /* */
  7246. /* left_glyph :: The index of the left glyph in the kern pair. */
  7247. /* */
  7248. /* right_glyph :: The index of the right glyph in the kern pair. */
  7249. /* */
  7250. /* kern_mode :: See @FT_Kerning_Mode for more information. */
  7251. /* Determines the scale and dimension of the returned */
  7252. /* kerning vector. */
  7253. /* */
  7254. /* <Output> */
  7255. /* akerning :: The kerning vector. This is either in font units */
  7256. /* or in pixels (26.6 format) for scalable formats, */
  7257. /* and in pixels for fixed-sizes formats. */
  7258. /* */
  7259. /* <Return> */
  7260. /* FreeType error code. 0~means success. */
  7261. /* */
  7262. /* <Note> */
  7263. /* Only horizontal layouts (left-to-right & right-to-left) are */
  7264. /* supported by this method. Other layouts, or more sophisticated */
  7265. /* kernings, are out of the scope of this API function -- they can be */
  7266. /* implemented through format-specific interfaces. */
  7267. /* */
  7268. FT_EXPORT( FT_Error )
  7269. FT_Get_Kerning( FT_Face face,
  7270. FT_UInt left_glyph,
  7271. FT_UInt right_glyph,
  7272. FT_UInt kern_mode,
  7273. FT_Vector *akerning );
  7274. /*************************************************************************/
  7275. /* */
  7276. /* <Function> */
  7277. /* FT_Get_Track_Kerning */
  7278. /* */
  7279. /* <Description> */
  7280. /* Return the track kerning for a given face object at a given size. */
  7281. /* */
  7282. /* <Input> */
  7283. /* face :: A handle to a source face object. */
  7284. /* */
  7285. /* point_size :: The point size in 16.16 fractional points. */
  7286. /* */
  7287. /* degree :: The degree of tightness. Increasingly negative */
  7288. /* values represent tighter track kerning, while */
  7289. /* increasingly positive values represent looser track */
  7290. /* kerning. Value zero means no track kerning. */
  7291. /* */
  7292. /* <Output> */
  7293. /* akerning :: The kerning in 16.16 fractional points, to be */
  7294. /* uniformly applied between all glyphs. */
  7295. /* */
  7296. /* <Return> */
  7297. /* FreeType error code. 0~means success. */
  7298. /* */
  7299. /* <Note> */
  7300. /* Currently, only the Type~1 font driver supports track kerning, */
  7301. /* using data from AFM files (if attached with @FT_Attach_File or */
  7302. /* @FT_Attach_Stream). */
  7303. /* */
  7304. /* Only very few AFM files come with track kerning data; please refer */
  7305. /* to the Adobe's AFM specification for more details. */
  7306. /* */
  7307. FT_EXPORT( FT_Error )
  7308. FT_Get_Track_Kerning( FT_Face face,
  7309. FT_Fixed point_size,
  7310. FT_Int degree,
  7311. FT_Fixed* akerning );
  7312. /*************************************************************************/
  7313. /* */
  7314. /* <Function> */
  7315. /* FT_Get_Glyph_Name */
  7316. /* */
  7317. /* <Description> */
  7318. /* Retrieve the ASCII name of a given glyph in a face. This only */
  7319. /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
  7320. /* */
  7321. /* <Input> */
  7322. /* face :: A handle to a source face object. */
  7323. /* */
  7324. /* glyph_index :: The glyph index. */
  7325. /* */
  7326. /* buffer_max :: The maximum number of bytes available in the */
  7327. /* buffer. */
  7328. /* */
  7329. /* <Output> */
  7330. /* buffer :: A pointer to a target buffer where the name is */
  7331. /* copied to. */
  7332. /* */
  7333. /* <Return> */
  7334. /* FreeType error code. 0~means success. */
  7335. /* */
  7336. /* <Note> */
  7337. /* An error is returned if the face doesn't provide glyph names or if */
  7338. /* the glyph index is invalid. In all cases of failure, the first */
  7339. /* byte of `buffer' is set to~0 to indicate an empty name. */
  7340. /* */
  7341. /* The glyph name is truncated to fit within the buffer if it is too */
  7342. /* long. The returned string is always zero-terminated. */
  7343. /* */
  7344. /* Be aware that FreeType reorders glyph indices internally so that */
  7345. /* glyph index~0 always corresponds to the `missing glyph' (called */
  7346. /* `.notdef'). */
  7347. /* */
  7348. /* This function is not compiled within the library if the config */
  7349. /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
  7350. /* `include/freetype/config/ftoptions.h'. */
  7351. /* */
  7352. FT_EXPORT( FT_Error )
  7353. FT_Get_Glyph_Name( FT_Face face,
  7354. FT_UInt glyph_index,
  7355. FT_Pointer buffer,
  7356. FT_UInt buffer_max );
  7357. /*************************************************************************/
  7358. /* */
  7359. /* <Function> */
  7360. /* FT_Get_Postscript_Name */
  7361. /* */
  7362. /* <Description> */
  7363. /* Retrieve the ASCII PostScript name of a given face, if available. */
  7364. /* This only works with PostScript and TrueType fonts. */
  7365. /* */
  7366. /* <Input> */
  7367. /* face :: A handle to the source face object. */
  7368. /* */
  7369. /* <Return> */
  7370. /* A pointer to the face's PostScript name. NULL if unavailable. */
  7371. /* */
  7372. /* <Note> */
  7373. /* The returned pointer is owned by the face and is destroyed with */
  7374. /* it. */
  7375. /* */
  7376. FT_EXPORT( const char* )
  7377. FT_Get_Postscript_Name( FT_Face face );
  7378. /*************************************************************************/
  7379. /* */
  7380. /* <Function> */
  7381. /* FT_Select_Charmap */
  7382. /* */
  7383. /* <Description> */
  7384. /* Select a given charmap by its encoding tag (as listed in */
  7385. /* `freetype.h'). */
  7386. /* */
  7387. /* <InOut> */
  7388. /* face :: A handle to the source face object. */
  7389. /* */
  7390. /* <Input> */
  7391. /* encoding :: A handle to the selected encoding. */
  7392. /* */
  7393. /* <Return> */
  7394. /* FreeType error code. 0~means success. */
  7395. /* */
  7396. /* <Note> */
  7397. /* This function returns an error if no charmap in the face */
  7398. /* corresponds to the encoding queried here. */
  7399. /* */
  7400. /* Because many fonts contain more than a single cmap for Unicode */
  7401. /* encoding, this function has some special code to select the one */
  7402. /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */
  7403. /* is preferred to a UCS-2 cmap). It is thus preferable to */
  7404. /* @FT_Set_Charmap in this case. */
  7405. /* */
  7406. FT_EXPORT( FT_Error )
  7407. FT_Select_Charmap( FT_Face face,
  7408. FT_Encoding encoding );
  7409. /*************************************************************************/
  7410. /* */
  7411. /* <Function> */
  7412. /* FT_Set_Charmap */
  7413. /* */
  7414. /* <Description> */
  7415. /* Select a given charmap for character code to glyph index mapping. */
  7416. /* */
  7417. /* <InOut> */
  7418. /* face :: A handle to the source face object. */
  7419. /* */
  7420. /* <Input> */
  7421. /* charmap :: A handle to the selected charmap. */
  7422. /* */
  7423. /* <Return> */
  7424. /* FreeType error code. 0~means success. */
  7425. /* */
  7426. /* <Note> */
  7427. /* This function returns an error if the charmap is not part of */
  7428. /* the face (i.e., if it is not listed in the `face->charmaps' */
  7429. /* table). */
  7430. /* */
  7431. /* It also fails if a type~14 charmap is selected. */
  7432. /* */
  7433. FT_EXPORT( FT_Error )
  7434. FT_Set_Charmap( FT_Face face,
  7435. FT_CharMap charmap );
  7436. /*************************************************************************
  7437. *
  7438. * @function:
  7439. * FT_Get_Charmap_Index
  7440. *
  7441. * @description:
  7442. * Retrieve index of a given charmap.
  7443. *
  7444. * @input:
  7445. * charmap ::
  7446. * A handle to a charmap.
  7447. *
  7448. * @return:
  7449. * The index into the array of character maps within the face to which
  7450. * `charmap' belongs. If an error occurs, -1 is returned.
  7451. *
  7452. */
  7453. FT_EXPORT( FT_Int )
  7454. FT_Get_Charmap_Index( FT_CharMap charmap );
  7455. /*************************************************************************/
  7456. /* */
  7457. /* <Function> */
  7458. /* FT_Get_Char_Index */
  7459. /* */
  7460. /* <Description> */
  7461. /* Return the glyph index of a given character code. This function */
  7462. /* uses a charmap object to do the mapping. */
  7463. /* */
  7464. /* <Input> */
  7465. /* face :: A handle to the source face object. */
  7466. /* */
  7467. /* charcode :: The character code. */
  7468. /* */
  7469. /* <Return> */
  7470. /* The glyph index. 0~means `undefined character code'. */
  7471. /* */
  7472. /* <Note> */
  7473. /* If you use FreeType to manipulate the contents of font files */
  7474. /* directly, be aware that the glyph index returned by this function */
  7475. /* doesn't always correspond to the internal indices used within the */
  7476. /* file. This is done to ensure that value~0 always corresponds to */
  7477. /* the `missing glyph'. If the first glyph is not named `.notdef', */
  7478. /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
  7479. /* the glyph ID~0 position, and whatever was there will be moved to */
  7480. /* the position `.notdef' had. For Type~1 fonts, if there is no */
  7481. /* `.notdef' glyph at all, then one will be created at index~0 and */
  7482. /* whatever was there will be moved to the last index -- Type~42 */
  7483. /* fonts are considered invalid under this condition. */
  7484. /* */
  7485. FT_EXPORT( FT_UInt )
  7486. FT_Get_Char_Index( FT_Face face,
  7487. FT_ULong charcode );
  7488. /*************************************************************************/
  7489. /* */
  7490. /* <Function> */
  7491. /* FT_Get_First_Char */
  7492. /* */
  7493. /* <Description> */
  7494. /* This function is used to return the first character code in the */
  7495. /* current charmap of a given face. It also returns the */
  7496. /* corresponding glyph index. */
  7497. /* */
  7498. /* <Input> */
  7499. /* face :: A handle to the source face object. */
  7500. /* */
  7501. /* <Output> */
  7502. /* agindex :: Glyph index of first character code. 0~if charmap is */
  7503. /* empty. */
  7504. /* */
  7505. /* <Return> */
  7506. /* The charmap's first character code. */
  7507. /* */
  7508. /* <Note> */
  7509. /* You should use this function with @FT_Get_Next_Char to be able to */
  7510. /* parse all character codes available in a given charmap. The code */
  7511. /* should look like this: */
  7512. /* */
  7513. /* { */
  7514. /* FT_ULong charcode; */
  7515. /* FT_UInt gindex; */
  7516. /* */
  7517. /* */
  7518. /* charcode = FT_Get_First_Char( face, &gindex ); */
  7519. /* while ( gindex != 0 ) */
  7520. /* { */
  7521. /* ... do something with (charcode,gindex) pair ... */
  7522. /* */
  7523. /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
  7524. /* } */
  7525. /* } */
  7526. /* */
  7527. /* Note that `*agindex' is set to~0 if the charmap is empty. The */
  7528. /* result itself can be~0 in two cases: if the charmap is empty or */
  7529. /* if the value~0 is the first valid character code. */
  7530. /* */
  7531. FT_EXPORT( FT_ULong )
  7532. FT_Get_First_Char( FT_Face face,
  7533. FT_UInt *agindex );
  7534. /*************************************************************************/
  7535. /* */
  7536. /* <Function> */
  7537. /* FT_Get_Next_Char */
  7538. /* */
  7539. /* <Description> */
  7540. /* This function is used to return the next character code in the */
  7541. /* current charmap of a given face following the value `char_code', */
  7542. /* as well as the corresponding glyph index. */
  7543. /* */
  7544. /* <Input> */
  7545. /* face :: A handle to the source face object. */
  7546. /* char_code :: The starting character code. */
  7547. /* */
  7548. /* <Output> */
  7549. /* agindex :: Glyph index of next character code. 0~if charmap */
  7550. /* is empty. */
  7551. /* */
  7552. /* <Return> */
  7553. /* The charmap's next character code. */
  7554. /* */
  7555. /* <Note> */
  7556. /* You should use this function with @FT_Get_First_Char to walk */
  7557. /* over all character codes available in a given charmap. See the */
  7558. /* note for this function for a simple code example. */
  7559. /* */
  7560. /* Note that `*agindex' is set to~0 when there are no more codes in */
  7561. /* the charmap. */
  7562. /* */
  7563. FT_EXPORT( FT_ULong )
  7564. FT_Get_Next_Char( FT_Face face,
  7565. FT_ULong char_code,
  7566. FT_UInt *agindex );
  7567. /*************************************************************************/
  7568. /* */
  7569. /* <Function> */
  7570. /* FT_Get_Name_Index */
  7571. /* */
  7572. /* <Description> */
  7573. /* Return the glyph index of a given glyph name. This function uses */
  7574. /* driver specific objects to do the translation. */
  7575. /* */
  7576. /* <Input> */
  7577. /* face :: A handle to the source face object. */
  7578. /* */
  7579. /* glyph_name :: The glyph name. */
  7580. /* */
  7581. /* <Return> */
  7582. /* The glyph index. 0~means `undefined character code'. */
  7583. /* */
  7584. FT_EXPORT( FT_UInt )
  7585. FT_Get_Name_Index( FT_Face face,
  7586. FT_String* glyph_name );
  7587. /*************************************************************************
  7588. *
  7589. * @macro:
  7590. * FT_SUBGLYPH_FLAG_XXX
  7591. *
  7592. * @description:
  7593. * A list of constants used to describe subglyphs. Please refer to the
  7594. * TrueType specification for the meaning of the various flags.
  7595. *
  7596. * @values:
  7597. * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
  7598. * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
  7599. * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
  7600. * FT_SUBGLYPH_FLAG_SCALE ::
  7601. * FT_SUBGLYPH_FLAG_XY_SCALE ::
  7602. * FT_SUBGLYPH_FLAG_2X2 ::
  7603. * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
  7604. *
  7605. */
  7606. #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
  7607. #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
  7608. #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
  7609. #define FT_SUBGLYPH_FLAG_SCALE 8
  7610. #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
  7611. #define FT_SUBGLYPH_FLAG_2X2 0x80
  7612. #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
  7613. /*************************************************************************
  7614. *
  7615. * @func:
  7616. * FT_Get_SubGlyph_Info
  7617. *
  7618. * @description:
  7619. * Retrieve a description of a given subglyph. Only use it if
  7620. * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
  7621. * returned otherwise.
  7622. *
  7623. * @input:
  7624. * glyph ::
  7625. * The source glyph slot.
  7626. *
  7627. * sub_index ::
  7628. * The index of the subglyph. Must be less than
  7629. * `glyph->num_subglyphs'.
  7630. *
  7631. * @output:
  7632. * p_index ::
  7633. * The glyph index of the subglyph.
  7634. *
  7635. * p_flags ::
  7636. * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
  7637. *
  7638. * p_arg1 ::
  7639. * The subglyph's first argument (if any).
  7640. *
  7641. * p_arg2 ::
  7642. * The subglyph's second argument (if any).
  7643. *
  7644. * p_transform ::
  7645. * The subglyph transformation (if any).
  7646. *
  7647. * @return:
  7648. * FreeType error code. 0~means success.
  7649. *
  7650. * @note:
  7651. * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
  7652. * interpreted depending on the flags returned in `*p_flags'. See the
  7653. * TrueType specification for details.
  7654. *
  7655. */
  7656. FT_EXPORT( FT_Error )
  7657. FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
  7658. FT_UInt sub_index,
  7659. FT_Int *p_index,
  7660. FT_UInt *p_flags,
  7661. FT_Int *p_arg1,
  7662. FT_Int *p_arg2,
  7663. FT_Matrix *p_transform );
  7664. /*************************************************************************/
  7665. /* */
  7666. /* <Enum> */
  7667. /* FT_FSTYPE_XXX */
  7668. /* */
  7669. /* <Description> */
  7670. /* A list of bit flags used in the `fsType' field of the OS/2 table */
  7671. /* in a TrueType or OpenType font and the `FSType' entry in a */
  7672. /* PostScript font. These bit flags are returned by */
  7673. /* @FT_Get_FSType_Flags; they inform client applications of embedding */
  7674. /* and subsetting restrictions associated with a font. */
  7675. /* */
  7676. /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */
  7677. /* more details. */
  7678. /* */
  7679. /* <Values> */
  7680. /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
  7681. /* Fonts with no fsType bit set may be embedded and permanently */
  7682. /* installed on the remote system by an application. */
  7683. /* */
  7684. /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
  7685. /* Fonts that have only this bit set must not be modified, embedded */
  7686. /* or exchanged in any manner without first obtaining permission of */
  7687. /* the font software copyright owner. */
  7688. /* */
  7689. /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
  7690. /* If this bit is set, the font may be embedded and temporarily */
  7691. /* loaded on the remote system. Documents containing Preview & */
  7692. /* Print fonts must be opened `read-only'; no edits can be applied */
  7693. /* to the document. */
  7694. /* */
  7695. /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
  7696. /* If this bit is set, the font may be embedded but must only be */
  7697. /* installed temporarily on other systems. In contrast to Preview */
  7698. /* & Print fonts, documents containing editable fonts may be opened */
  7699. /* for reading, editing is permitted, and changes may be saved. */
  7700. /* */
  7701. /* FT_FSTYPE_NO_SUBSETTING :: */
  7702. /* If this bit is set, the font may not be subsetted prior to */
  7703. /* embedding. */
  7704. /* */
  7705. /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
  7706. /* If this bit is set, only bitmaps contained in the font may be */
  7707. /* embedded; no outline data may be embedded. If there are no */
  7708. /* bitmaps available in the font, then the font is unembeddable. */
  7709. /* */
  7710. /* <Note> */
  7711. /* While the fsType flags can indicate that a font may be embedded, a */
  7712. /* license with the font vendor may be separately required to use the */
  7713. /* font in this way. */
  7714. /* */
  7715. #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
  7716. #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
  7717. #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
  7718. #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
  7719. #define FT_FSTYPE_NO_SUBSETTING 0x0100
  7720. #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
  7721. /*************************************************************************/
  7722. /* */
  7723. /* <Function> */
  7724. /* FT_Get_FSType_Flags */
  7725. /* */
  7726. /* <Description> */
  7727. /* Return the fsType flags for a font. */
  7728. /* */
  7729. /* <Input> */
  7730. /* face :: A handle to the source face object. */
  7731. /* */
  7732. /* <Return> */
  7733. /* The fsType flags, @FT_FSTYPE_XXX. */
  7734. /* */
  7735. /* <Note> */
  7736. /* Use this function rather than directly reading the `fs_type' field */
  7737. /* in the @PS_FontInfoRec structure which is only guaranteed to */
  7738. /* return the correct results for Type~1 fonts. */
  7739. /* */
  7740. /* <Since> */
  7741. /* 2.3.8 */
  7742. /* */
  7743. FT_EXPORT( FT_UShort )
  7744. FT_Get_FSType_Flags( FT_Face face );
  7745. /*************************************************************************/
  7746. /* */
  7747. /* <Section> */
  7748. /* glyph_variants */
  7749. /* */
  7750. /* <Title> */
  7751. /* Glyph Variants */
  7752. /* */
  7753. /* <Abstract> */
  7754. /* The FreeType~2 interface to Unicode Ideographic Variation */
  7755. /* Sequences (IVS), using the SFNT cmap format~14. */
  7756. /* */
  7757. /* <Description> */
  7758. /* Many CJK characters have variant forms. They are a sort of grey */
  7759. /* area somewhere between being totally irrelevant and semantically */
  7760. /* distinct; for this reason, the Unicode consortium decided to */
  7761. /* introduce Ideographic Variation Sequences (IVS), consisting of a */
  7762. /* Unicode base character and one of 240 variant selectors */
  7763. /* (U+E0100-U+E01EF), instead of further extending the already huge */
  7764. /* code range for CJK characters. */
  7765. /* */
  7766. /* An IVS is registered and unique; for further details please refer */
  7767. /* to Unicode Technical Standard #37, the Ideographic Variation */
  7768. /* Database: */
  7769. /* */
  7770. /* http://www.unicode.org/reports/tr37/ */
  7771. /* */
  7772. /* To date (November 2012), the character with the most variants is */
  7773. /* U+9089, having 31 such IVS. */
  7774. /* */
  7775. /* Adobe and MS decided to support IVS with a new cmap subtable */
  7776. /* (format~14). It is an odd subtable because it is not a mapping of */
  7777. /* input code points to glyphs, but contains lists of all variants */
  7778. /* supported by the font. */
  7779. /* */
  7780. /* A variant may be either `default' or `non-default'. A default */
  7781. /* variant is the one you will get for that code point if you look it */
  7782. /* up in the standard Unicode cmap. A non-default variant is a */
  7783. /* different glyph. */
  7784. /* */
  7785. /*************************************************************************/
  7786. /*************************************************************************/
  7787. /* */
  7788. /* <Function> */
  7789. /* FT_Face_GetCharVariantIndex */
  7790. /* */
  7791. /* <Description> */
  7792. /* Return the glyph index of a given character code as modified by */
  7793. /* the variation selector. */
  7794. /* */
  7795. /* <Input> */
  7796. /* face :: */
  7797. /* A handle to the source face object. */
  7798. /* */
  7799. /* charcode :: */
  7800. /* The character code point in Unicode. */
  7801. /* */
  7802. /* variantSelector :: */
  7803. /* The Unicode code point of the variation selector. */
  7804. /* */
  7805. /* <Return> */
  7806. /* The glyph index. 0~means either `undefined character code', or */
  7807. /* `undefined selector code', or `no variation selector cmap */
  7808. /* subtable', or `current CharMap is not Unicode'. */
  7809. /* */
  7810. /* <Note> */
  7811. /* If you use FreeType to manipulate the contents of font files */
  7812. /* directly, be aware that the glyph index returned by this function */
  7813. /* doesn't always correspond to the internal indices used within */
  7814. /* the file. This is done to ensure that value~0 always corresponds */
  7815. /* to the `missing glyph'. */
  7816. /* */
  7817. /* This function is only meaningful if */
  7818. /* a) the font has a variation selector cmap sub table, */
  7819. /* and */
  7820. /* b) the current charmap has a Unicode encoding. */
  7821. /* */
  7822. /* <Since> */
  7823. /* 2.3.6 */
  7824. /* */
  7825. FT_EXPORT( FT_UInt )
  7826. FT_Face_GetCharVariantIndex( FT_Face face,
  7827. FT_ULong charcode,
  7828. FT_ULong variantSelector );
  7829. /*************************************************************************/
  7830. /* */
  7831. /* <Function> */
  7832. /* FT_Face_GetCharVariantIsDefault */
  7833. /* */
  7834. /* <Description> */
  7835. /* Check whether this variant of this Unicode character is the one to */
  7836. /* be found in the `cmap'. */
  7837. /* */
  7838. /* <Input> */
  7839. /* face :: */
  7840. /* A handle to the source face object. */
  7841. /* */
  7842. /* charcode :: */
  7843. /* The character codepoint in Unicode. */
  7844. /* */
  7845. /* variantSelector :: */
  7846. /* The Unicode codepoint of the variation selector. */
  7847. /* */
  7848. /* <Return> */
  7849. /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
  7850. /* variation selector cmap, or -1 if it is not a variant. */
  7851. /* */
  7852. /* <Note> */
  7853. /* This function is only meaningful if the font has a variation */
  7854. /* selector cmap subtable. */
  7855. /* */
  7856. /* <Since> */
  7857. /* 2.3.6 */
  7858. /* */
  7859. FT_EXPORT( FT_Int )
  7860. FT_Face_GetCharVariantIsDefault( FT_Face face,
  7861. FT_ULong charcode,
  7862. FT_ULong variantSelector );
  7863. /*************************************************************************/
  7864. /* */
  7865. /* <Function> */
  7866. /* FT_Face_GetVariantSelectors */
  7867. /* */
  7868. /* <Description> */
  7869. /* Return a zero-terminated list of Unicode variant selectors found */
  7870. /* in the font. */
  7871. /* */
  7872. /* <Input> */
  7873. /* face :: */
  7874. /* A handle to the source face object. */
  7875. /* */
  7876. /* <Return> */
  7877. /* A pointer to an array of selector code points, or NULL if there is */
  7878. /* no valid variant selector cmap subtable. */
  7879. /* */
  7880. /* <Note> */
  7881. /* The last item in the array is~0; the array is owned by the */
  7882. /* @FT_Face object but can be overwritten or released on the next */
  7883. /* call to a FreeType function. */
  7884. /* */
  7885. /* <Since> */
  7886. /* 2.3.6 */
  7887. /* */
  7888. FT_EXPORT( FT_UInt32* )
  7889. FT_Face_GetVariantSelectors( FT_Face face );
  7890. /*************************************************************************/
  7891. /* */
  7892. /* <Function> */
  7893. /* FT_Face_GetVariantsOfChar */
  7894. /* */
  7895. /* <Description> */
  7896. /* Return a zero-terminated list of Unicode variant selectors found */
  7897. /* for the specified character code. */
  7898. /* */
  7899. /* <Input> */
  7900. /* face :: */
  7901. /* A handle to the source face object. */
  7902. /* */
  7903. /* charcode :: */
  7904. /* The character codepoint in Unicode. */
  7905. /* */
  7906. /* <Return> */
  7907. /* A pointer to an array of variant selector code points which are */
  7908. /* active for the given character, or NULL if the corresponding list */
  7909. /* is empty. */
  7910. /* */
  7911. /* <Note> */
  7912. /* The last item in the array is~0; the array is owned by the */
  7913. /* @FT_Face object but can be overwritten or released on the next */
  7914. /* call to a FreeType function. */
  7915. /* */
  7916. /* <Since> */
  7917. /* 2.3.6 */
  7918. /* */
  7919. FT_EXPORT( FT_UInt32* )
  7920. FT_Face_GetVariantsOfChar( FT_Face face,
  7921. FT_ULong charcode );
  7922. /*************************************************************************/
  7923. /* */
  7924. /* <Function> */
  7925. /* FT_Face_GetCharsOfVariant */
  7926. /* */
  7927. /* <Description> */
  7928. /* Return a zero-terminated list of Unicode character codes found for */
  7929. /* the specified variant selector. */
  7930. /* */
  7931. /* <Input> */
  7932. /* face :: */
  7933. /* A handle to the source face object. */
  7934. /* */
  7935. /* variantSelector :: */
  7936. /* The variant selector code point in Unicode. */
  7937. /* */
  7938. /* <Return> */
  7939. /* A list of all the code points which are specified by this selector */
  7940. /* (both default and non-default codes are returned) or NULL if there */
  7941. /* is no valid cmap or the variant selector is invalid. */
  7942. /* */
  7943. /* <Note> */
  7944. /* The last item in the array is~0; the array is owned by the */
  7945. /* @FT_Face object but can be overwritten or released on the next */
  7946. /* call to a FreeType function. */
  7947. /* */
  7948. /* <Since> */
  7949. /* 2.3.6 */
  7950. /* */
  7951. FT_EXPORT( FT_UInt32* )
  7952. FT_Face_GetCharsOfVariant( FT_Face face,
  7953. FT_ULong variantSelector );
  7954. /*************************************************************************/
  7955. /* */
  7956. /* <Section> */
  7957. /* computations */
  7958. /* */
  7959. /* <Title> */
  7960. /* Computations */
  7961. /* */
  7962. /* <Abstract> */
  7963. /* Crunching fixed numbers and vectors. */
  7964. /* */
  7965. /* <Description> */
  7966. /* This section contains various functions used to perform */
  7967. /* computations on 16.16 fixed-float numbers or 2d vectors. */
  7968. /* */
  7969. /* <Order> */
  7970. /* FT_MulDiv */
  7971. /* FT_MulFix */
  7972. /* FT_DivFix */
  7973. /* FT_RoundFix */
  7974. /* FT_CeilFix */
  7975. /* FT_FloorFix */
  7976. /* FT_Vector_Transform */
  7977. /* FT_Matrix_Multiply */
  7978. /* FT_Matrix_Invert */
  7979. /* */
  7980. /*************************************************************************/
  7981. /*************************************************************************/
  7982. /* */
  7983. /* <Function> */
  7984. /* FT_MulDiv */
  7985. /* */
  7986. /* <Description> */
  7987. /* A very simple function used to perform the computation `(a*b)/c' */
  7988. /* with maximum accuracy (it uses a 64-bit intermediate integer */
  7989. /* whenever necessary). */
  7990. /* */
  7991. /* This function isn't necessarily as fast as some processor specific */
  7992. /* operations, but is at least completely portable. */
  7993. /* */
  7994. /* <Input> */
  7995. /* a :: The first multiplier. */
  7996. /* b :: The second multiplier. */
  7997. /* c :: The divisor. */
  7998. /* */
  7999. /* <Return> */
  8000. /* The result of `(a*b)/c'. This function never traps when trying to */
  8001. /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
  8002. /* on the signs of `a' and `b'. */
  8003. /* */
  8004. FT_EXPORT( FT_Long )
  8005. FT_MulDiv( FT_Long a,
  8006. FT_Long b,
  8007. FT_Long c );
  8008. /* */
  8009. /* The following #if 0 ... #endif is for the documentation formatter, */
  8010. /* hiding the internal `FT_MULFIX_INLINED' macro. */
  8011. #if 0
  8012. /*************************************************************************/
  8013. /* */
  8014. /* <Function> */
  8015. /* FT_MulFix */
  8016. /* */
  8017. /* <Description> */
  8018. /* A very simple function used to perform the computation */
  8019. /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */
  8020. /* used to multiply a given value by a 16.16 fixed-point factor. */
  8021. /* */
  8022. /* <Input> */
  8023. /* a :: The first multiplier. */
  8024. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  8025. /* possible (see note below). */
  8026. /* */
  8027. /* <Return> */
  8028. /* The result of `(a*b)/0x10000'. */
  8029. /* */
  8030. /* <Note> */
  8031. /* This function has been optimized for the case where the absolute */
  8032. /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
  8033. /* As this happens mainly when scaling from notional units to */
  8034. /* fractional pixels in FreeType, it resulted in noticeable speed */
  8035. /* improvements between versions 2.x and 1.x. */
  8036. /* */
  8037. /* As a conclusion, always try to place a 16.16 factor as the */
  8038. /* _second_ argument of this function; this can make a great */
  8039. /* difference. */
  8040. /* */
  8041. FT_EXPORT( FT_Long )
  8042. FT_MulFix( FT_Long a,
  8043. FT_Long b );
  8044. /* */
  8045. #endif
  8046. #ifdef FT_MULFIX_INLINED
  8047. #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
  8048. #else
  8049. FT_EXPORT( FT_Long )
  8050. FT_MulFix( FT_Long a,
  8051. FT_Long b );
  8052. #endif
  8053. /*************************************************************************/
  8054. /* */
  8055. /* <Function> */
  8056. /* FT_DivFix */
  8057. /* */
  8058. /* <Description> */
  8059. /* A very simple function used to perform the computation */
  8060. /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
  8061. /* used to divide a given value by a 16.16 fixed-point factor. */
  8062. /* */
  8063. /* <Input> */
  8064. /* a :: The first multiplier. */
  8065. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  8066. /* possible (see note below). */
  8067. /* */
  8068. /* <Return> */
  8069. /* The result of `(a*0x10000)/b'. */
  8070. /* */
  8071. /* <Note> */
  8072. /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */
  8073. /* 32~bits, then the division is computed directly. Otherwise, we */
  8074. /* use a specialized version of @FT_MulDiv. */
  8075. /* */
  8076. FT_EXPORT( FT_Long )
  8077. FT_DivFix( FT_Long a,
  8078. FT_Long b );
  8079. /*************************************************************************/
  8080. /* */
  8081. /* <Function> */
  8082. /* FT_RoundFix */
  8083. /* */
  8084. /* <Description> */
  8085. /* A very simple function used to round a 16.16 fixed number. */
  8086. /* */
  8087. /* <Input> */
  8088. /* a :: The number to be rounded. */
  8089. /* */
  8090. /* <Return> */
  8091. /* The result of `(a + 0x8000) & -0x10000'. */
  8092. /* */
  8093. FT_EXPORT( FT_Fixed )
  8094. FT_RoundFix( FT_Fixed a );
  8095. /*************************************************************************/
  8096. /* */
  8097. /* <Function> */
  8098. /* FT_CeilFix */
  8099. /* */
  8100. /* <Description> */
  8101. /* A very simple function used to compute the ceiling function of a */
  8102. /* 16.16 fixed number. */
  8103. /* */
  8104. /* <Input> */
  8105. /* a :: The number for which the ceiling function is to be computed. */
  8106. /* */
  8107. /* <Return> */
  8108. /* The result of `(a + 0x10000 - 1) & -0x10000'. */
  8109. /* */
  8110. FT_EXPORT( FT_Fixed )
  8111. FT_CeilFix( FT_Fixed a );
  8112. /*************************************************************************/
  8113. /* */
  8114. /* <Function> */
  8115. /* FT_FloorFix */
  8116. /* */
  8117. /* <Description> */
  8118. /* A very simple function used to compute the floor function of a */
  8119. /* 16.16 fixed number. */
  8120. /* */
  8121. /* <Input> */
  8122. /* a :: The number for which the floor function is to be computed. */
  8123. /* */
  8124. /* <Return> */
  8125. /* The result of `a & -0x10000'. */
  8126. /* */
  8127. FT_EXPORT( FT_Fixed )
  8128. FT_FloorFix( FT_Fixed a );
  8129. /*************************************************************************/
  8130. /* */
  8131. /* <Function> */
  8132. /* FT_Vector_Transform */
  8133. /* */
  8134. /* <Description> */
  8135. /* Transform a single vector through a 2x2 matrix. */
  8136. /* */
  8137. /* <InOut> */
  8138. /* vector :: The target vector to transform. */
  8139. /* */
  8140. /* <Input> */
  8141. /* matrix :: A pointer to the source 2x2 matrix. */
  8142. /* */
  8143. /* <Note> */
  8144. /* The result is undefined if either `vector' or `matrix' is invalid. */
  8145. /* */
  8146. FT_EXPORT( void )
  8147. FT_Vector_Transform( FT_Vector* vec,
  8148. const FT_Matrix* matrix );
  8149. /*************************************************************************/
  8150. /* */
  8151. /* <Section> */
  8152. /* version */
  8153. /* */
  8154. /* <Title> */
  8155. /* FreeType Version */
  8156. /* */
  8157. /* <Abstract> */
  8158. /* Functions and macros related to FreeType versions. */
  8159. /* */
  8160. /* <Description> */
  8161. /* Note that those functions and macros are of limited use because */
  8162. /* even a new release of FreeType with only documentation changes */
  8163. /* increases the version number. */
  8164. /* */
  8165. /*************************************************************************/
  8166. /*************************************************************************
  8167. *
  8168. * @enum:
  8169. * FREETYPE_XXX
  8170. *
  8171. * @description:
  8172. * These three macros identify the FreeType source code version.
  8173. * Use @FT_Library_Version to access them at runtime.
  8174. *
  8175. * @values:
  8176. * FREETYPE_MAJOR :: The major version number.
  8177. * FREETYPE_MINOR :: The minor version number.
  8178. * FREETYPE_PATCH :: The patch level.
  8179. *
  8180. * @note:
  8181. * The version number of FreeType if built as a dynamic link library
  8182. * with the `libtool' package is _not_ controlled by these three
  8183. * macros.
  8184. *
  8185. */
  8186. #define FREETYPE_MAJOR 2
  8187. #define FREETYPE_MINOR 4
  8188. #define FREETYPE_PATCH 12
  8189. /*************************************************************************/
  8190. /* */
  8191. /* <Function> */
  8192. /* FT_Library_Version */
  8193. /* */
  8194. /* <Description> */
  8195. /* Return the version of the FreeType library being used. This is */
  8196. /* useful when dynamically linking to the library, since one cannot */
  8197. /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
  8198. /* @FREETYPE_PATCH. */
  8199. /* */
  8200. /* <Input> */
  8201. /* library :: A source library handle. */
  8202. /* */
  8203. /* <Output> */
  8204. /* amajor :: The major version number. */
  8205. /* */
  8206. /* aminor :: The minor version number. */
  8207. /* */
  8208. /* apatch :: The patch version number. */
  8209. /* */
  8210. /* <Note> */
  8211. /* The reason why this function takes a `library' argument is because */
  8212. /* certain programs implement library initialization in a custom way */
  8213. /* that doesn't use @FT_Init_FreeType. */
  8214. /* */
  8215. /* In such cases, the library version might not be available before */
  8216. /* the library object has been created. */
  8217. /* */
  8218. FT_EXPORT( void )
  8219. FT_Library_Version( FT_Library library,
  8220. FT_Int *amajor,
  8221. FT_Int *aminor,
  8222. FT_Int *apatch );
  8223. /*************************************************************************/
  8224. /* */
  8225. /* <Function> */
  8226. /* FT_Face_CheckTrueTypePatents */
  8227. /* */
  8228. /* <Description> */
  8229. /* Parse all bytecode instructions of a TrueType font file to check */
  8230. /* whether any of the patented opcodes are used. This is only useful */
  8231. /* if you want to be able to use the unpatented hinter with */
  8232. /* fonts that do *not* use these opcodes. */
  8233. /* */
  8234. /* Note that this function parses *all* glyph instructions in the */
  8235. /* font file, which may be slow. */
  8236. /* */
  8237. /* <Input> */
  8238. /* face :: A face handle. */
  8239. /* */
  8240. /* <Return> */
  8241. /* 1~if this is a TrueType font that uses one of the patented */
  8242. /* opcodes, 0~otherwise. */
  8243. /* */
  8244. /* <Note> */
  8245. /* Since May 2010, TrueType hinting is no longer patented. */
  8246. /* */
  8247. /* <Since> */
  8248. /* 2.3.5 */
  8249. /* */
  8250. FT_EXPORT( FT_Bool )
  8251. FT_Face_CheckTrueTypePatents( FT_Face face );
  8252. /*************************************************************************/
  8253. /* */
  8254. /* <Function> */
  8255. /* FT_Face_SetUnpatentedHinting */
  8256. /* */
  8257. /* <Description> */
  8258. /* Enable or disable the unpatented hinter for a given face. */
  8259. /* Only enable it if you have determined that the face doesn't */
  8260. /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
  8261. /* */
  8262. /* <Input> */
  8263. /* face :: A face handle. */
  8264. /* */
  8265. /* value :: New boolean setting. */
  8266. /* */
  8267. /* <Return> */
  8268. /* The old setting value. This will always be false if this is not */
  8269. /* an SFNT font, or if the unpatented hinter is not compiled in this */
  8270. /* instance of the library. */
  8271. /* */
  8272. /* <Note> */
  8273. /* Since May 2010, TrueType hinting is no longer patented. */
  8274. /* */
  8275. /* <Since> */
  8276. /* 2.3.5 */
  8277. /* */
  8278. FT_EXPORT( FT_Bool )
  8279. FT_Face_SetUnpatentedHinting( FT_Face face,
  8280. FT_Bool value );
  8281. /* */
  8282. FT_END_HEADER
  8283. #endif /* __FREETYPE_H__ */
  8284. /* END */
  8285. /*** End of inlined file: freetype.h ***/
  8286. /*
  8287. * These headers are normally included manually but we add them
  8288. * here for completeness.
  8289. *
  8290. */
  8291. /*** Start of inlined file: ftgasp.h ***/
  8292. /* */
  8293. /* ftgasp.h */
  8294. /* */
  8295. /* Access of TrueType's `gasp' table (specification). */
  8296. /* */
  8297. /* Copyright 2007, 2008, 2011 by */
  8298. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  8299. /* */
  8300. /* This file is part of the FreeType project, and may only be used, */
  8301. /* modified, and distributed under the terms of the FreeType project */
  8302. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  8303. /* this file you indicate that you have read the license and */
  8304. /* understand and accept it fully. */
  8305. /* */
  8306. /***************************************************************************/
  8307. #ifndef _FT_GASP_H_
  8308. #define _FT_GASP_H_
  8309. #ifdef FREETYPE_H
  8310. #error "freetype.h of FreeType 1 has been loaded!"
  8311. #error "Please fix the directory search order for header files"
  8312. #error "so that freetype.h of FreeType 2 is found first."
  8313. #endif
  8314. /***************************************************************************
  8315. *
  8316. * @section:
  8317. * gasp_table
  8318. *
  8319. * @title:
  8320. * Gasp Table
  8321. *
  8322. * @abstract:
  8323. * Retrieving TrueType `gasp' table entries.
  8324. *
  8325. * @description:
  8326. * The function @FT_Get_Gasp can be used to query a TrueType or OpenType
  8327. * font for specific entries in its `gasp' table, if any. This is
  8328. * mainly useful when implementing native TrueType hinting with the
  8329. * bytecode interpreter to duplicate the Windows text rendering results.
  8330. */
  8331. /*************************************************************************
  8332. *
  8333. * @enum:
  8334. * FT_GASP_XXX
  8335. *
  8336. * @description:
  8337. * A list of values and/or bit-flags returned by the @FT_Get_Gasp
  8338. * function.
  8339. *
  8340. * @values:
  8341. * FT_GASP_NO_TABLE ::
  8342. * This special value means that there is no GASP table in this face.
  8343. * It is up to the client to decide what to do.
  8344. *
  8345. * FT_GASP_DO_GRIDFIT ::
  8346. * Grid-fitting and hinting should be performed at the specified ppem.
  8347. * This *really* means TrueType bytecode interpretation. If this bit
  8348. * is not set, no hinting gets applied.
  8349. *
  8350. * FT_GASP_DO_GRAY ::
  8351. * Anti-aliased rendering should be performed at the specified ppem.
  8352. * If not set, do monochrome rendering.
  8353. *
  8354. * FT_GASP_SYMMETRIC_SMOOTHING ::
  8355. * If set, smoothing along multiple axes must be used with ClearType.
  8356. *
  8357. * FT_GASP_SYMMETRIC_GRIDFIT ::
  8358. * Grid-fitting must be used with ClearType's symmetric smoothing.
  8359. *
  8360. * @note:
  8361. * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be
  8362. * used for standard font rasterization only. Independently of that,
  8363. * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to
  8364. * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and
  8365. * `FT_GASP_DO_GRAY' are consequently ignored).
  8366. *
  8367. * `ClearType' is Microsoft's implementation of LCD rendering, partly
  8368. * protected by patents.
  8369. *
  8370. * @since:
  8371. * 2.3.0
  8372. */
  8373. #define FT_GASP_NO_TABLE -1
  8374. #define FT_GASP_DO_GRIDFIT 0x01
  8375. #define FT_GASP_DO_GRAY 0x02
  8376. #define FT_GASP_SYMMETRIC_SMOOTHING 0x08
  8377. #define FT_GASP_SYMMETRIC_GRIDFIT 0x10
  8378. /*************************************************************************
  8379. *
  8380. * @func:
  8381. * FT_Get_Gasp
  8382. *
  8383. * @description:
  8384. * Read the `gasp' table from a TrueType or OpenType font file and
  8385. * return the entry corresponding to a given character pixel size.
  8386. *
  8387. * @input:
  8388. * face :: The source face handle.
  8389. * ppem :: The vertical character pixel size.
  8390. *
  8391. * @return:
  8392. * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
  8393. * `gasp' table in the face.
  8394. *
  8395. * @since:
  8396. * 2.3.0
  8397. */
  8398. FT_EXPORT( FT_Int )
  8399. FT_Get_Gasp( FT_Face face,
  8400. FT_UInt ppem );
  8401. /* */
  8402. #endif /* _FT_GASP_H_ */
  8403. /* END */
  8404. /*** End of inlined file: ftgasp.h ***/
  8405. /*** Start of inlined file: ftglyph.h ***/
  8406. /* */
  8407. /* ftglyph.h */
  8408. /* */
  8409. /* FreeType convenience functions to handle glyphs (specification). */
  8410. /* */
  8411. /* Copyright 1996-2003, 2006, 2008, 2009, 2011 by */
  8412. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  8413. /* */
  8414. /* This file is part of the FreeType project, and may only be used, */
  8415. /* modified, and distributed under the terms of the FreeType project */
  8416. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  8417. /* this file you indicate that you have read the license and */
  8418. /* understand and accept it fully. */
  8419. /* */
  8420. /***************************************************************************/
  8421. /*************************************************************************/
  8422. /* */
  8423. /* This file contains the definition of several convenience functions */
  8424. /* that can be used by client applications to easily retrieve glyph */
  8425. /* bitmaps and outlines from a given face. */
  8426. /* */
  8427. /* These functions should be optional if you are writing a font server */
  8428. /* or text layout engine on top of FreeType. However, they are pretty */
  8429. /* handy for many other simple uses of the library. */
  8430. /* */
  8431. /*************************************************************************/
  8432. #ifndef __FTGLYPH_H__
  8433. #define __FTGLYPH_H__
  8434. #ifdef FREETYPE_H
  8435. #error "freetype.h of FreeType 1 has been loaded!"
  8436. #error "Please fix the directory search order for header files"
  8437. #error "so that freetype.h of FreeType 2 is found first."
  8438. #endif
  8439. FT_BEGIN_HEADER
  8440. /*************************************************************************/
  8441. /* */
  8442. /* <Section> */
  8443. /* glyph_management */
  8444. /* */
  8445. /* <Title> */
  8446. /* Glyph Management */
  8447. /* */
  8448. /* <Abstract> */
  8449. /* Generic interface to manage individual glyph data. */
  8450. /* */
  8451. /* <Description> */
  8452. /* This section contains definitions used to manage glyph data */
  8453. /* through generic FT_Glyph objects. Each of them can contain a */
  8454. /* bitmap, a vector outline, or even images in other formats. */
  8455. /* */
  8456. /*************************************************************************/
  8457. /* forward declaration to a private type */
  8458. typedef struct FT_Glyph_Class_ FT_Glyph_Class;
  8459. /*************************************************************************/
  8460. /* */
  8461. /* <Type> */
  8462. /* FT_Glyph */
  8463. /* */
  8464. /* <Description> */
  8465. /* Handle to an object used to model generic glyph images. It is a */
  8466. /* pointer to the @FT_GlyphRec structure and can contain a glyph */
  8467. /* bitmap or pointer. */
  8468. /* */
  8469. /* <Note> */
  8470. /* Glyph objects are not owned by the library. You must thus release */
  8471. /* them manually (through @FT_Done_Glyph) _before_ calling */
  8472. /* @FT_Done_FreeType. */
  8473. /* */
  8474. typedef struct FT_GlyphRec_* FT_Glyph;
  8475. /*************************************************************************/
  8476. /* */
  8477. /* <Struct> */
  8478. /* FT_GlyphRec */
  8479. /* */
  8480. /* <Description> */
  8481. /* The root glyph structure contains a given glyph image plus its */
  8482. /* advance width in 16.16 fixed-point format. */
  8483. /* */
  8484. /* <Fields> */
  8485. /* library :: A handle to the FreeType library object. */
  8486. /* */
  8487. /* clazz :: A pointer to the glyph's class. Private. */
  8488. /* */
  8489. /* format :: The format of the glyph's image. */
  8490. /* */
  8491. /* advance :: A 16.16 vector that gives the glyph's advance width. */
  8492. /* */
  8493. typedef struct FT_GlyphRec_
  8494. {
  8495. FT_Library library;
  8496. const FT_Glyph_Class* clazz;
  8497. FT_Glyph_Format format;
  8498. FT_Vector advance;
  8499. } FT_GlyphRec;
  8500. /*************************************************************************/
  8501. /* */
  8502. /* <Type> */
  8503. /* FT_BitmapGlyph */
  8504. /* */
  8505. /* <Description> */
  8506. /* A handle to an object used to model a bitmap glyph image. This is */
  8507. /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */
  8508. /* */
  8509. typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;
  8510. /*************************************************************************/
  8511. /* */
  8512. /* <Struct> */
  8513. /* FT_BitmapGlyphRec */
  8514. /* */
  8515. /* <Description> */
  8516. /* A structure used for bitmap glyph images. This really is a */
  8517. /* `sub-class' of @FT_GlyphRec. */
  8518. /* */
  8519. /* <Fields> */
  8520. /* root :: The root @FT_Glyph fields. */
  8521. /* */
  8522. /* left :: The left-side bearing, i.e., the horizontal distance */
  8523. /* from the current pen position to the left border of the */
  8524. /* glyph bitmap. */
  8525. /* */
  8526. /* top :: The top-side bearing, i.e., the vertical distance from */
  8527. /* the current pen position to the top border of the glyph */
  8528. /* bitmap. This distance is positive for upwards~y! */
  8529. /* */
  8530. /* bitmap :: A descriptor for the bitmap. */
  8531. /* */
  8532. /* <Note> */
  8533. /* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */
  8534. /* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */
  8535. /* the bitmap's contents easily. */
  8536. /* */
  8537. /* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */
  8538. /* and is thus created and destroyed with it. */
  8539. /* */
  8540. typedef struct FT_BitmapGlyphRec_
  8541. {
  8542. FT_GlyphRec root;
  8543. FT_Int left;
  8544. FT_Int top;
  8545. FT_Bitmap bitmap;
  8546. } FT_BitmapGlyphRec;
  8547. /*************************************************************************/
  8548. /* */
  8549. /* <Type> */
  8550. /* FT_OutlineGlyph */
  8551. /* */
  8552. /* <Description> */
  8553. /* A handle to an object used to model an outline glyph image. This */
  8554. /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */
  8555. /* */
  8556. typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;
  8557. /*************************************************************************/
  8558. /* */
  8559. /* <Struct> */
  8560. /* FT_OutlineGlyphRec */
  8561. /* */
  8562. /* <Description> */
  8563. /* A structure used for outline (vectorial) glyph images. This */
  8564. /* really is a `sub-class' of @FT_GlyphRec. */
  8565. /* */
  8566. /* <Fields> */
  8567. /* root :: The root @FT_Glyph fields. */
  8568. /* */
  8569. /* outline :: A descriptor for the outline. */
  8570. /* */
  8571. /* <Note> */
  8572. /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */
  8573. /* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */
  8574. /* the outline's content easily. */
  8575. /* */
  8576. /* As the outline is extracted from a glyph slot, its coordinates are */
  8577. /* expressed normally in 26.6 pixels, unless the flag */
  8578. /* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */
  8579. /* */
  8580. /* The outline's tables are always owned by the object and are */
  8581. /* destroyed with it. */
  8582. /* */
  8583. typedef struct FT_OutlineGlyphRec_
  8584. {
  8585. FT_GlyphRec root;
  8586. FT_Outline outline;
  8587. } FT_OutlineGlyphRec;
  8588. /*************************************************************************/
  8589. /* */
  8590. /* <Function> */
  8591. /* FT_Get_Glyph */
  8592. /* */
  8593. /* <Description> */
  8594. /* A function used to extract a glyph image from a slot. Note that */
  8595. /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */
  8596. /* */
  8597. /* <Input> */
  8598. /* slot :: A handle to the source glyph slot. */
  8599. /* */
  8600. /* <Output> */
  8601. /* aglyph :: A handle to the glyph object. */
  8602. /* */
  8603. /* <Return> */
  8604. /* FreeType error code. 0~means success. */
  8605. /* */
  8606. FT_EXPORT( FT_Error )
  8607. FT_Get_Glyph( FT_GlyphSlot slot,
  8608. FT_Glyph *aglyph );
  8609. /*************************************************************************/
  8610. /* */
  8611. /* <Function> */
  8612. /* FT_Glyph_Copy */
  8613. /* */
  8614. /* <Description> */
  8615. /* A function used to copy a glyph image. Note that the created */
  8616. /* @FT_Glyph object must be released with @FT_Done_Glyph. */
  8617. /* */
  8618. /* <Input> */
  8619. /* source :: A handle to the source glyph object. */
  8620. /* */
  8621. /* <Output> */
  8622. /* target :: A handle to the target glyph object. 0~in case of */
  8623. /* error. */
  8624. /* */
  8625. /* <Return> */
  8626. /* FreeType error code. 0~means success. */
  8627. /* */
  8628. FT_EXPORT( FT_Error )
  8629. FT_Glyph_Copy( FT_Glyph source,
  8630. FT_Glyph *target );
  8631. /*************************************************************************/
  8632. /* */
  8633. /* <Function> */
  8634. /* FT_Glyph_Transform */
  8635. /* */
  8636. /* <Description> */
  8637. /* Transform a glyph image if its format is scalable. */
  8638. /* */
  8639. /* <InOut> */
  8640. /* glyph :: A handle to the target glyph object. */
  8641. /* */
  8642. /* <Input> */
  8643. /* matrix :: A pointer to a 2x2 matrix to apply. */
  8644. /* */
  8645. /* delta :: A pointer to a 2d vector to apply. Coordinates are */
  8646. /* expressed in 1/64th of a pixel. */
  8647. /* */
  8648. /* <Return> */
  8649. /* FreeType error code (if not 0, the glyph format is not scalable). */
  8650. /* */
  8651. /* <Note> */
  8652. /* The 2x2 transformation matrix is also applied to the glyph's */
  8653. /* advance vector. */
  8654. /* */
  8655. FT_EXPORT( FT_Error )
  8656. FT_Glyph_Transform( FT_Glyph glyph,
  8657. FT_Matrix* matrix,
  8658. FT_Vector* delta );
  8659. /*************************************************************************/
  8660. /* */
  8661. /* <Enum> */
  8662. /* FT_Glyph_BBox_Mode */
  8663. /* */
  8664. /* <Description> */
  8665. /* The mode how the values of @FT_Glyph_Get_CBox are returned. */
  8666. /* */
  8667. /* <Values> */
  8668. /* FT_GLYPH_BBOX_UNSCALED :: */
  8669. /* Return unscaled font units. */
  8670. /* */
  8671. /* FT_GLYPH_BBOX_SUBPIXELS :: */
  8672. /* Return unfitted 26.6 coordinates. */
  8673. /* */
  8674. /* FT_GLYPH_BBOX_GRIDFIT :: */
  8675. /* Return grid-fitted 26.6 coordinates. */
  8676. /* */
  8677. /* FT_GLYPH_BBOX_TRUNCATE :: */
  8678. /* Return coordinates in integer pixels. */
  8679. /* */
  8680. /* FT_GLYPH_BBOX_PIXELS :: */
  8681. /* Return grid-fitted pixel coordinates. */
  8682. /* */
  8683. typedef enum FT_Glyph_BBox_Mode_
  8684. {
  8685. FT_GLYPH_BBOX_UNSCALED = 0,
  8686. FT_GLYPH_BBOX_SUBPIXELS = 0,
  8687. FT_GLYPH_BBOX_GRIDFIT = 1,
  8688. FT_GLYPH_BBOX_TRUNCATE = 2,
  8689. FT_GLYPH_BBOX_PIXELS = 3
  8690. } FT_Glyph_BBox_Mode;
  8691. /*************************************************************************/
  8692. /* */
  8693. /* <Enum> */
  8694. /* ft_glyph_bbox_xxx */
  8695. /* */
  8696. /* <Description> */
  8697. /* These constants are deprecated. Use the corresponding */
  8698. /* @FT_Glyph_BBox_Mode values instead. */
  8699. /* */
  8700. /* <Values> */
  8701. /* ft_glyph_bbox_unscaled :: See @FT_GLYPH_BBOX_UNSCALED. */
  8702. /* ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS. */
  8703. /* ft_glyph_bbox_gridfit :: See @FT_GLYPH_BBOX_GRIDFIT. */
  8704. /* ft_glyph_bbox_truncate :: See @FT_GLYPH_BBOX_TRUNCATE. */
  8705. /* ft_glyph_bbox_pixels :: See @FT_GLYPH_BBOX_PIXELS. */
  8706. /* */
  8707. #define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED
  8708. #define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS
  8709. #define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT
  8710. #define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE
  8711. #define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS
  8712. /*************************************************************************/
  8713. /* */
  8714. /* <Function> */
  8715. /* FT_Glyph_Get_CBox */
  8716. /* */
  8717. /* <Description> */
  8718. /* Return a glyph's `control box'. The control box encloses all the */
  8719. /* outline's points, including Bézier control points. Though it */
  8720. /* coincides with the exact bounding box for most glyphs, it can be */
  8721. /* slightly larger in some situations (like when rotating an outline */
  8722. /* which contains Bézier outside arcs). */
  8723. /* */
  8724. /* Computing the control box is very fast, while getting the bounding */
  8725. /* box can take much more time as it needs to walk over all segments */
  8726. /* and arcs in the outline. To get the latter, you can use the */
  8727. /* `ftbbox' component which is dedicated to this single task. */
  8728. /* */
  8729. /* <Input> */
  8730. /* glyph :: A handle to the source glyph object. */
  8731. /* */
  8732. /* mode :: The mode which indicates how to interpret the returned */
  8733. /* bounding box values. */
  8734. /* */
  8735. /* <Output> */
  8736. /* acbox :: The glyph coordinate bounding box. Coordinates are */
  8737. /* expressed in 1/64th of pixels if it is grid-fitted. */
  8738. /* */
  8739. /* <Note> */
  8740. /* Coordinates are relative to the glyph origin, using the y~upwards */
  8741. /* convention. */
  8742. /* */
  8743. /* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */
  8744. /* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */
  8745. /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */
  8746. /* is another name for this constant. */
  8747. /* */
  8748. /* If the font is tricky and the glyph has been loaded with */
  8749. /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */
  8750. /* reasonable values for the CBox it is necessary to load the glyph */
  8751. /* at a large ppem value (so that the hinting instructions can */
  8752. /* properly shift and scale the subglyphs), then extracting the CBox */
  8753. /* which can be eventually converted back to font units. */
  8754. /* */
  8755. /* Note that the maximum coordinates are exclusive, which means that */
  8756. /* one can compute the width and height of the glyph image (be it in */
  8757. /* integer or 26.6 pixels) as: */
  8758. /* */
  8759. /* { */
  8760. /* width = bbox.xMax - bbox.xMin; */
  8761. /* height = bbox.yMax - bbox.yMin; */
  8762. /* } */
  8763. /* */
  8764. /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */
  8765. /* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */
  8766. /* which corresponds to: */
  8767. /* */
  8768. /* { */
  8769. /* bbox.xMin = FLOOR(bbox.xMin); */
  8770. /* bbox.yMin = FLOOR(bbox.yMin); */
  8771. /* bbox.xMax = CEILING(bbox.xMax); */
  8772. /* bbox.yMax = CEILING(bbox.yMax); */
  8773. /* } */
  8774. /* */
  8775. /* To get the bbox in pixel coordinates, set `bbox_mode' to */
  8776. /* @FT_GLYPH_BBOX_TRUNCATE. */
  8777. /* */
  8778. /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */
  8779. /* to @FT_GLYPH_BBOX_PIXELS. */
  8780. /* */
  8781. FT_EXPORT( void )
  8782. FT_Glyph_Get_CBox( FT_Glyph glyph,
  8783. FT_UInt bbox_mode,
  8784. FT_BBox *acbox );
  8785. /*************************************************************************/
  8786. /* */
  8787. /* <Function> */
  8788. /* FT_Glyph_To_Bitmap */
  8789. /* */
  8790. /* <Description> */
  8791. /* Convert a given glyph object to a bitmap glyph object. */
  8792. /* */
  8793. /* <InOut> */
  8794. /* the_glyph :: A pointer to a handle to the target glyph. */
  8795. /* */
  8796. /* <Input> */
  8797. /* render_mode :: An enumeration that describes how the data is */
  8798. /* rendered. */
  8799. /* */
  8800. /* origin :: A pointer to a vector used to translate the glyph */
  8801. /* image before rendering. Can be~0 (if no */
  8802. /* translation). The origin is expressed in */
  8803. /* 26.6 pixels. */
  8804. /* */
  8805. /* destroy :: A boolean that indicates that the original glyph */
  8806. /* image should be destroyed by this function. It is */
  8807. /* never destroyed in case of error. */
  8808. /* */
  8809. /* <Return> */
  8810. /* FreeType error code. 0~means success. */
  8811. /* */
  8812. /* <Note> */
  8813. /* This function does nothing if the glyph format isn't scalable. */
  8814. /* */
  8815. /* The glyph image is translated with the `origin' vector before */
  8816. /* rendering. */
  8817. /* */
  8818. /* The first parameter is a pointer to an @FT_Glyph handle, that will */
  8819. /* be _replaced_ by this function (with newly allocated data). */
  8820. /* Typically, you would use (omitting error handling): */
  8821. /* */
  8822. /* */
  8823. /* { */
  8824. /* FT_Glyph glyph; */
  8825. /* FT_BitmapGlyph glyph_bitmap; */
  8826. /* */
  8827. /* */
  8828. /* // load glyph */
  8829. /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */
  8830. /* */
  8831. /* // extract glyph image */
  8832. /* error = FT_Get_Glyph( face->glyph, &glyph ); */
  8833. /* */
  8834. /* // convert to a bitmap (default render mode + destroying old) */
  8835. /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
  8836. /* { */
  8837. /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */
  8838. /* 0, 1 ); */
  8839. /* if ( error ) // `glyph' unchanged */
  8840. /* ... */
  8841. /* } */
  8842. /* */
  8843. /* // access bitmap content by typecasting */
  8844. /* glyph_bitmap = (FT_BitmapGlyph)glyph; */
  8845. /* */
  8846. /* // do funny stuff with it, like blitting/drawing */
  8847. /* ... */
  8848. /* */
  8849. /* // discard glyph image (bitmap or not) */
  8850. /* FT_Done_Glyph( glyph ); */
  8851. /* } */
  8852. /* */
  8853. /* */
  8854. /* Here another example, again without error handling: */
  8855. /* */
  8856. /* */
  8857. /* { */
  8858. /* FT_Glyph glyphs[MAX_GLYPHS] */
  8859. /* */
  8860. /* */
  8861. /* ... */
  8862. /* */
  8863. /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
  8864. /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */
  8865. /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */
  8866. /* */
  8867. /* ... */
  8868. /* */
  8869. /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
  8870. /* { */
  8871. /* FT_Glyph bitmap = glyphs[idx]; */
  8872. /* */
  8873. /* */
  8874. /* ... */
  8875. /* */
  8876. /* // after this call, `bitmap' no longer points into */
  8877. /* // the `glyphs' array (and the old value isn't destroyed) */
  8878. /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */
  8879. /* */
  8880. /* ... */
  8881. /* */
  8882. /* FT_Done_Glyph( bitmap ); */
  8883. /* } */
  8884. /* */
  8885. /* ... */
  8886. /* */
  8887. /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */
  8888. /* FT_Done_Glyph( glyphs[idx] ); */
  8889. /* } */
  8890. /* */
  8891. FT_EXPORT( FT_Error )
  8892. FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
  8893. FT_Render_Mode render_mode,
  8894. FT_Vector* origin,
  8895. FT_Bool destroy );
  8896. /*************************************************************************/
  8897. /* */
  8898. /* <Function> */
  8899. /* FT_Done_Glyph */
  8900. /* */
  8901. /* <Description> */
  8902. /* Destroy a given glyph. */
  8903. /* */
  8904. /* <Input> */
  8905. /* glyph :: A handle to the target glyph object. */
  8906. /* */
  8907. FT_EXPORT( void )
  8908. FT_Done_Glyph( FT_Glyph glyph );
  8909. /* */
  8910. /* other helpful functions */
  8911. /*************************************************************************/
  8912. /* */
  8913. /* <Section> */
  8914. /* computations */
  8915. /* */
  8916. /*************************************************************************/
  8917. /*************************************************************************/
  8918. /* */
  8919. /* <Function> */
  8920. /* FT_Matrix_Multiply */
  8921. /* */
  8922. /* <Description> */
  8923. /* Perform the matrix operation `b = a*b'. */
  8924. /* */
  8925. /* <Input> */
  8926. /* a :: A pointer to matrix `a'. */
  8927. /* */
  8928. /* <InOut> */
  8929. /* b :: A pointer to matrix `b'. */
  8930. /* */
  8931. /* <Note> */
  8932. /* The result is undefined if either `a' or `b' is zero. */
  8933. /* */
  8934. FT_EXPORT( void )
  8935. FT_Matrix_Multiply( const FT_Matrix* a,
  8936. FT_Matrix* b );
  8937. /*************************************************************************/
  8938. /* */
  8939. /* <Function> */
  8940. /* FT_Matrix_Invert */
  8941. /* */
  8942. /* <Description> */
  8943. /* Invert a 2x2 matrix. Return an error if it can't be inverted. */
  8944. /* */
  8945. /* <InOut> */
  8946. /* matrix :: A pointer to the target matrix. Remains untouched in */
  8947. /* case of error. */
  8948. /* */
  8949. /* <Return> */
  8950. /* FreeType error code. 0~means success. */
  8951. /* */
  8952. FT_EXPORT( FT_Error )
  8953. FT_Matrix_Invert( FT_Matrix* matrix );
  8954. /* */
  8955. FT_END_HEADER
  8956. #endif /* __FTGLYPH_H__ */
  8957. /* END */
  8958. /* Local Variables: */
  8959. /* coding: utf-8 */
  8960. /* End: */
  8961. /*** End of inlined file: ftglyph.h ***/
  8962. /*** Start of inlined file: ftoutln.h ***/
  8963. /* */
  8964. /* ftoutln.h */
  8965. /* */
  8966. /* Support for the FT_Outline type used to store glyph shapes of */
  8967. /* most scalable font formats (specification). */
  8968. /* */
  8969. /* Copyright 1996-2003, 2005-2012 by */
  8970. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  8971. /* */
  8972. /* This file is part of the FreeType project, and may only be used, */
  8973. /* modified, and distributed under the terms of the FreeType project */
  8974. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  8975. /* this file you indicate that you have read the license and */
  8976. /* understand and accept it fully. */
  8977. /* */
  8978. /***************************************************************************/
  8979. #ifndef __FTOUTLN_H__
  8980. #define __FTOUTLN_H__
  8981. #ifdef FREETYPE_H
  8982. #error "freetype.h of FreeType 1 has been loaded!"
  8983. #error "Please fix the directory search order for header files"
  8984. #error "so that freetype.h of FreeType 2 is found first."
  8985. #endif
  8986. FT_BEGIN_HEADER
  8987. /*************************************************************************/
  8988. /* */
  8989. /* <Section> */
  8990. /* outline_processing */
  8991. /* */
  8992. /* <Title> */
  8993. /* Outline Processing */
  8994. /* */
  8995. /* <Abstract> */
  8996. /* Functions to create, transform, and render vectorial glyph images. */
  8997. /* */
  8998. /* <Description> */
  8999. /* This section contains routines used to create and destroy scalable */
  9000. /* glyph images known as `outlines'. These can also be measured, */
  9001. /* transformed, and converted into bitmaps and pixmaps. */
  9002. /* */
  9003. /* <Order> */
  9004. /* FT_Outline */
  9005. /* FT_OUTLINE_FLAGS */
  9006. /* FT_Outline_New */
  9007. /* FT_Outline_Done */
  9008. /* FT_Outline_Copy */
  9009. /* FT_Outline_Translate */
  9010. /* FT_Outline_Transform */
  9011. /* FT_Outline_Embolden */
  9012. /* FT_Outline_EmboldenXY */
  9013. /* FT_Outline_Reverse */
  9014. /* FT_Outline_Check */
  9015. /* */
  9016. /* FT_Outline_Get_CBox */
  9017. /* FT_Outline_Get_BBox */
  9018. /* */
  9019. /* FT_Outline_Get_Bitmap */
  9020. /* FT_Outline_Render */
  9021. /* */
  9022. /* FT_Outline_Decompose */
  9023. /* FT_Outline_Funcs */
  9024. /* FT_Outline_MoveTo_Func */
  9025. /* FT_Outline_LineTo_Func */
  9026. /* FT_Outline_ConicTo_Func */
  9027. /* FT_Outline_CubicTo_Func */
  9028. /* */
  9029. /*************************************************************************/
  9030. /*************************************************************************/
  9031. /* */
  9032. /* <Function> */
  9033. /* FT_Outline_Decompose */
  9034. /* */
  9035. /* <Description> */
  9036. /* Walk over an outline's structure to decompose it into individual */
  9037. /* segments and Bézier arcs. This function also emits `move to' */
  9038. /* operations to indicate the start of new contours in the outline. */
  9039. /* */
  9040. /* <Input> */
  9041. /* outline :: A pointer to the source target. */
  9042. /* */
  9043. /* func_interface :: A table of `emitters', i.e., function pointers */
  9044. /* called during decomposition to indicate path */
  9045. /* operations. */
  9046. /* */
  9047. /* <InOut> */
  9048. /* user :: A typeless pointer which is passed to each */
  9049. /* emitter during the decomposition. It can be */
  9050. /* used to store the state during the */
  9051. /* decomposition. */
  9052. /* */
  9053. /* <Return> */
  9054. /* FreeType error code. 0~means success. */
  9055. /* */
  9056. FT_EXPORT( FT_Error )
  9057. FT_Outline_Decompose( FT_Outline* outline,
  9058. const FT_Outline_Funcs* func_interface,
  9059. void* user );
  9060. /*************************************************************************/
  9061. /* */
  9062. /* <Function> */
  9063. /* FT_Outline_New */
  9064. /* */
  9065. /* <Description> */
  9066. /* Create a new outline of a given size. */
  9067. /* */
  9068. /* <Input> */
  9069. /* library :: A handle to the library object from where the */
  9070. /* outline is allocated. Note however that the new */
  9071. /* outline will *not* necessarily be *freed*, when */
  9072. /* destroying the library, by @FT_Done_FreeType. */
  9073. /* */
  9074. /* numPoints :: The maximum number of points within the outline. */
  9075. /* Must be smaller than or equal to 0xFFFF (65535). */
  9076. /* */
  9077. /* numContours :: The maximum number of contours within the outline. */
  9078. /* This value must be in the range 0 to `numPoints'. */
  9079. /* */
  9080. /* <Output> */
  9081. /* anoutline :: A handle to the new outline. */
  9082. /* */
  9083. /* <Return> */
  9084. /* FreeType error code. 0~means success. */
  9085. /* */
  9086. /* <Note> */
  9087. /* The reason why this function takes a `library' parameter is simply */
  9088. /* to use the library's memory allocator. */
  9089. /* */
  9090. FT_EXPORT( FT_Error )
  9091. FT_Outline_New( FT_Library library,
  9092. FT_UInt numPoints,
  9093. FT_Int numContours,
  9094. FT_Outline *anoutline );
  9095. FT_EXPORT( FT_Error )
  9096. FT_Outline_New_Internal( FT_Memory memory,
  9097. FT_UInt numPoints,
  9098. FT_Int numContours,
  9099. FT_Outline *anoutline );
  9100. /*************************************************************************/
  9101. /* */
  9102. /* <Function> */
  9103. /* FT_Outline_Done */
  9104. /* */
  9105. /* <Description> */
  9106. /* Destroy an outline created with @FT_Outline_New. */
  9107. /* */
  9108. /* <Input> */
  9109. /* library :: A handle of the library object used to allocate the */
  9110. /* outline. */
  9111. /* */
  9112. /* outline :: A pointer to the outline object to be discarded. */
  9113. /* */
  9114. /* <Return> */
  9115. /* FreeType error code. 0~means success. */
  9116. /* */
  9117. /* <Note> */
  9118. /* If the outline's `owner' field is not set, only the outline */
  9119. /* descriptor will be released. */
  9120. /* */
  9121. /* The reason why this function takes an `library' parameter is */
  9122. /* simply to use ft_mem_free(). */
  9123. /* */
  9124. FT_EXPORT( FT_Error )
  9125. FT_Outline_Done( FT_Library library,
  9126. FT_Outline* outline );
  9127. FT_EXPORT( FT_Error )
  9128. FT_Outline_Done_Internal( FT_Memory memory,
  9129. FT_Outline* outline );
  9130. /*************************************************************************/
  9131. /* */
  9132. /* <Function> */
  9133. /* FT_Outline_Check */
  9134. /* */
  9135. /* <Description> */
  9136. /* Check the contents of an outline descriptor. */
  9137. /* */
  9138. /* <Input> */
  9139. /* outline :: A handle to a source outline. */
  9140. /* */
  9141. /* <Return> */
  9142. /* FreeType error code. 0~means success. */
  9143. /* */
  9144. FT_EXPORT( FT_Error )
  9145. FT_Outline_Check( FT_Outline* outline );
  9146. /*************************************************************************/
  9147. /* */
  9148. /* <Function> */
  9149. /* FT_Outline_Get_CBox */
  9150. /* */
  9151. /* <Description> */
  9152. /* Return an outline's `control box'. The control box encloses all */
  9153. /* the outline's points, including Bézier control points. Though it */
  9154. /* coincides with the exact bounding box for most glyphs, it can be */
  9155. /* slightly larger in some situations (like when rotating an outline */
  9156. /* which contains Bézier outside arcs). */
  9157. /* */
  9158. /* Computing the control box is very fast, while getting the bounding */
  9159. /* box can take much more time as it needs to walk over all segments */
  9160. /* and arcs in the outline. To get the latter, you can use the */
  9161. /* `ftbbox' component which is dedicated to this single task. */
  9162. /* */
  9163. /* <Input> */
  9164. /* outline :: A pointer to the source outline descriptor. */
  9165. /* */
  9166. /* <Output> */
  9167. /* acbox :: The outline's control box. */
  9168. /* */
  9169. /* <Note> */
  9170. /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */
  9171. /* */
  9172. FT_EXPORT( void )
  9173. FT_Outline_Get_CBox( const FT_Outline* outline,
  9174. FT_BBox *acbox );
  9175. /*************************************************************************/
  9176. /* */
  9177. /* <Function> */
  9178. /* FT_Outline_Translate */
  9179. /* */
  9180. /* <Description> */
  9181. /* Apply a simple translation to the points of an outline. */
  9182. /* */
  9183. /* <InOut> */
  9184. /* outline :: A pointer to the target outline descriptor. */
  9185. /* */
  9186. /* <Input> */
  9187. /* xOffset :: The horizontal offset. */
  9188. /* */
  9189. /* yOffset :: The vertical offset. */
  9190. /* */
  9191. FT_EXPORT( void )
  9192. FT_Outline_Translate( const FT_Outline* outline,
  9193. FT_Pos xOffset,
  9194. FT_Pos yOffset );
  9195. /*************************************************************************/
  9196. /* */
  9197. /* <Function> */
  9198. /* FT_Outline_Copy */
  9199. /* */
  9200. /* <Description> */
  9201. /* Copy an outline into another one. Both objects must have the */
  9202. /* same sizes (number of points & number of contours) when this */
  9203. /* function is called. */
  9204. /* */
  9205. /* <Input> */
  9206. /* source :: A handle to the source outline. */
  9207. /* */
  9208. /* <Output> */
  9209. /* target :: A handle to the target outline. */
  9210. /* */
  9211. /* <Return> */
  9212. /* FreeType error code. 0~means success. */
  9213. /* */
  9214. FT_EXPORT( FT_Error )
  9215. FT_Outline_Copy( const FT_Outline* source,
  9216. FT_Outline *target );
  9217. /*************************************************************************/
  9218. /* */
  9219. /* <Function> */
  9220. /* FT_Outline_Transform */
  9221. /* */
  9222. /* <Description> */
  9223. /* Apply a simple 2x2 matrix to all of an outline's points. Useful */
  9224. /* for applying rotations, slanting, flipping, etc. */
  9225. /* */
  9226. /* <InOut> */
  9227. /* outline :: A pointer to the target outline descriptor. */
  9228. /* */
  9229. /* <Input> */
  9230. /* matrix :: A pointer to the transformation matrix. */
  9231. /* */
  9232. /* <Note> */
  9233. /* You can use @FT_Outline_Translate if you need to translate the */
  9234. /* outline's points. */
  9235. /* */
  9236. FT_EXPORT( void )
  9237. FT_Outline_Transform( const FT_Outline* outline,
  9238. const FT_Matrix* matrix );
  9239. /*************************************************************************/
  9240. /* */
  9241. /* <Function> */
  9242. /* FT_Outline_Embolden */
  9243. /* */
  9244. /* <Description> */
  9245. /* Embolden an outline. The new outline will be at most 4~times */
  9246. /* `strength' pixels wider and higher. You may think of the left and */
  9247. /* bottom borders as unchanged. */
  9248. /* */
  9249. /* Negative `strength' values to reduce the outline thickness are */
  9250. /* possible also. */
  9251. /* */
  9252. /* <InOut> */
  9253. /* outline :: A handle to the target outline. */
  9254. /* */
  9255. /* <Input> */
  9256. /* strength :: How strong the glyph is emboldened. Expressed in */
  9257. /* 26.6 pixel format. */
  9258. /* */
  9259. /* <Return> */
  9260. /* FreeType error code. 0~means success. */
  9261. /* */
  9262. /* <Note> */
  9263. /* The used algorithm to increase or decrease the thickness of the */
  9264. /* glyph doesn't change the number of points; this means that certain */
  9265. /* situations like acute angles or intersections are sometimes */
  9266. /* handled incorrectly. */
  9267. /* */
  9268. /* If you need `better' metrics values you should call */
  9269. /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */
  9270. /* */
  9271. /* Example call: */
  9272. /* */
  9273. /* { */
  9274. /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */
  9275. /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */
  9276. /* FT_Outline_Embolden( &face->slot->outline, strength ); */
  9277. /* } */
  9278. /* */
  9279. FT_EXPORT( FT_Error )
  9280. FT_Outline_Embolden( FT_Outline* outline,
  9281. FT_Pos strength );
  9282. /*************************************************************************/
  9283. /* */
  9284. /* <Function> */
  9285. /* FT_Outline_EmboldenXY */
  9286. /* */
  9287. /* <Description> */
  9288. /* Embolden an outline. The new outline will be `xstrength' pixels */
  9289. /* wider and `ystrength' pixels higher. Otherwise, it is similar to */
  9290. /* @FT_Outline_Embolden, which uses the same strength in both */
  9291. /* directions. */
  9292. /* */
  9293. FT_EXPORT( FT_Error )
  9294. FT_Outline_EmboldenXY( FT_Outline* outline,
  9295. FT_Pos xstrength,
  9296. FT_Pos ystrength );
  9297. /*************************************************************************/
  9298. /* */
  9299. /* <Function> */
  9300. /* FT_Outline_Reverse */
  9301. /* */
  9302. /* <Description> */
  9303. /* Reverse the drawing direction of an outline. This is used to */
  9304. /* ensure consistent fill conventions for mirrored glyphs. */
  9305. /* */
  9306. /* <InOut> */
  9307. /* outline :: A pointer to the target outline descriptor. */
  9308. /* */
  9309. /* <Note> */
  9310. /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */
  9311. /* the outline's `flags' field. */
  9312. /* */
  9313. /* It shouldn't be used by a normal client application, unless it */
  9314. /* knows what it is doing. */
  9315. /* */
  9316. FT_EXPORT( void )
  9317. FT_Outline_Reverse( FT_Outline* outline );
  9318. /*************************************************************************/
  9319. /* */
  9320. /* <Function> */
  9321. /* FT_Outline_Get_Bitmap */
  9322. /* */
  9323. /* <Description> */
  9324. /* Render an outline within a bitmap. The outline's image is simply */
  9325. /* OR-ed to the target bitmap. */
  9326. /* */
  9327. /* <Input> */
  9328. /* library :: A handle to a FreeType library object. */
  9329. /* */
  9330. /* outline :: A pointer to the source outline descriptor. */
  9331. /* */
  9332. /* <InOut> */
  9333. /* abitmap :: A pointer to the target bitmap descriptor. */
  9334. /* */
  9335. /* <Return> */
  9336. /* FreeType error code. 0~means success. */
  9337. /* */
  9338. /* <Note> */
  9339. /* This function does NOT CREATE the bitmap, it only renders an */
  9340. /* outline image within the one you pass to it! Consequently, the */
  9341. /* various fields in `abitmap' should be set accordingly. */
  9342. /* */
  9343. /* It will use the raster corresponding to the default glyph format. */
  9344. /* */
  9345. /* The value of the `num_grays' field in `abitmap' is ignored. If */
  9346. /* you select the gray-level rasterizer, and you want less than 256 */
  9347. /* gray levels, you have to use @FT_Outline_Render directly. */
  9348. /* */
  9349. FT_EXPORT( FT_Error )
  9350. FT_Outline_Get_Bitmap( FT_Library library,
  9351. FT_Outline* outline,
  9352. const FT_Bitmap *abitmap );
  9353. /*************************************************************************/
  9354. /* */
  9355. /* <Function> */
  9356. /* FT_Outline_Render */
  9357. /* */
  9358. /* <Description> */
  9359. /* Render an outline within a bitmap using the current scan-convert. */
  9360. /* This function uses an @FT_Raster_Params structure as an argument, */
  9361. /* allowing advanced features like direct composition, translucency, */
  9362. /* etc. */
  9363. /* */
  9364. /* <Input> */
  9365. /* library :: A handle to a FreeType library object. */
  9366. /* */
  9367. /* outline :: A pointer to the source outline descriptor. */
  9368. /* */
  9369. /* <InOut> */
  9370. /* params :: A pointer to an @FT_Raster_Params structure used to */
  9371. /* describe the rendering operation. */
  9372. /* */
  9373. /* <Return> */
  9374. /* FreeType error code. 0~means success. */
  9375. /* */
  9376. /* <Note> */
  9377. /* You should know what you are doing and how @FT_Raster_Params works */
  9378. /* to use this function. */
  9379. /* */
  9380. /* The field `params.source' will be set to `outline' before the scan */
  9381. /* converter is called, which means that the value you give to it is */
  9382. /* actually ignored. */
  9383. /* */
  9384. /* The gray-level rasterizer always uses 256 gray levels. If you */
  9385. /* want less gray levels, you have to provide your own span callback. */
  9386. /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */
  9387. /* @FT_Raster_Params structure for more details. */
  9388. /* */
  9389. FT_EXPORT( FT_Error )
  9390. FT_Outline_Render( FT_Library library,
  9391. FT_Outline* outline,
  9392. FT_Raster_Params* params );
  9393. /**************************************************************************
  9394. *
  9395. * @enum:
  9396. * FT_Orientation
  9397. *
  9398. * @description:
  9399. * A list of values used to describe an outline's contour orientation.
  9400. *
  9401. * The TrueType and PostScript specifications use different conventions
  9402. * to determine whether outline contours should be filled or unfilled.
  9403. *
  9404. * @values:
  9405. * FT_ORIENTATION_TRUETYPE ::
  9406. * According to the TrueType specification, clockwise contours must
  9407. * be filled, and counter-clockwise ones must be unfilled.
  9408. *
  9409. * FT_ORIENTATION_POSTSCRIPT ::
  9410. * According to the PostScript specification, counter-clockwise contours
  9411. * must be filled, and clockwise ones must be unfilled.
  9412. *
  9413. * FT_ORIENTATION_FILL_RIGHT ::
  9414. * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
  9415. * remember that in TrueType, everything that is to the right of
  9416. * the drawing direction of a contour must be filled.
  9417. *
  9418. * FT_ORIENTATION_FILL_LEFT ::
  9419. * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
  9420. * remember that in PostScript, everything that is to the left of
  9421. * the drawing direction of a contour must be filled.
  9422. *
  9423. * FT_ORIENTATION_NONE ::
  9424. * The orientation cannot be determined. That is, different parts of
  9425. * the glyph have different orientation.
  9426. *
  9427. */
  9428. typedef enum FT_Orientation_
  9429. {
  9430. FT_ORIENTATION_TRUETYPE = 0,
  9431. FT_ORIENTATION_POSTSCRIPT = 1,
  9432. FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
  9433. FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT,
  9434. FT_ORIENTATION_NONE
  9435. } FT_Orientation;
  9436. /**************************************************************************
  9437. *
  9438. * @function:
  9439. * FT_Outline_Get_Orientation
  9440. *
  9441. * @description:
  9442. * This function analyzes a glyph outline and tries to compute its
  9443. * fill orientation (see @FT_Orientation). This is done by computing
  9444. * the direction of each global horizontal and/or vertical extrema
  9445. * within the outline.
  9446. *
  9447. * Note that this will return @FT_ORIENTATION_TRUETYPE for empty
  9448. * outlines.
  9449. *
  9450. * @input:
  9451. * outline ::
  9452. * A handle to the source outline.
  9453. *
  9454. * @return:
  9455. * The orientation.
  9456. *
  9457. */
  9458. FT_EXPORT( FT_Orientation )
  9459. FT_Outline_Get_Orientation( FT_Outline* outline );
  9460. /* */
  9461. FT_END_HEADER
  9462. #endif /* __FTOUTLN_H__ */
  9463. /* END */
  9464. /* Local Variables: */
  9465. /* coding: utf-8 */
  9466. /* End: */
  9467. /*** End of inlined file: ftoutln.h ***/
  9468. #ifdef _MSC_VER
  9469. #pragma pop_macro("_CRT_SECURE_NO_WARNINGS")
  9470. #endif