Graphic Fonts by AdrTru v.2 17.5.2016 ---------------------------------------- Describtion: ------------ System for writing Graphic(bitmap) fonts. There are 3 way for using. 1/ Creating object "graphic_text" for writing text to walls. 2/ Write text in gui hook 3/ prepare childeren for writing graphic text in GrimTK gui framework from John Worldsword Instalation: ------------ 1/ Copy "GraphicFonts" directory to mod_assets directory 2/ Add lines: -- create materials and object for Graphic Fonts import "mod_assets/GraphicFonts/init.lua" 3/ in dung editor make script entity in level 1 named "GF" and connect it to file "mod_assets/GraphicFonts/GraficFonts.lua" 4/ now you may use object - "graphic_text" Setting of object: ------------------ Parameters for "graphic_text" is setted in object parameters 1/ text in walltext component This is place for zour text. If are in text some @ char will be apply some parameter changes defined in setChanges parameter. 2/ setFont("hwScript") Name of used font usable values: -- LOGtext,hwScript,AvQuest,AvQuestx,Shaken,Palantino - "standart texts" -- Angerthas_g, Angerthas_s "rune text with normal map" -- Daedra_black,Daedra_red,Daedra_yellow, "Daedra runes with 3 color for standard painting" -- Daedra_Mblack,Daedra_Mred,Daedra_Myellow "Daedra runes with 3 color for modular painting (wall behind text is vissible) 3/ setRatio(1) multiplication of letter size. standard size for letter is 0.2x0.2 in dungeon editor usable values: any real 4/ setOffset(0,2,-0.01,0,0) offset of text in wall x,y,z, + line size, + letter distance (x -> left to right, y -> down to up, z -> party pos to far), x,z are modificated in script by facing linesize - standard for linesize is defined in font definition ( this value will modify this value for better writing to stone row on wall ) letter distance - modification this value change distance between letters 5/ setCenter(true) set layout for justification texts Center/Left 6/ setEmission(0.05,0,0) color for glowing text in dark pasages red,green,blue recommended value is smaller than 0.1 in channel 7/ setChanges({}) table of tables witch changing parameters in one text. This changes are apply in place where is @ in walltext availible parameters for change: font,ratio,center,dist,line,abs_x,abs_y,rel_x,rel_y,emission ( ratio can set only this values: 0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.5,2,2.5,3,3.5,4,4.5,5 - becouse are prepared suitible models) e.g. setChanges({ { ratio = 5, abs_x = 0, abs_y = 0.1}, { font = "Daedra_Mred", abs_y = 0, abs_x = -0.35, ratio = 2 }, { abs_y = 0.3, abs_x = -0.05, abs_z = -0.001 }, { font = "Daedra_Myellow", ratio = 5, abs_y = -0.5, abs_x = -0.2, abs_z = 0 }, { font = "Daedra_Mblack", ratio = 2, abs_y = -0.35, abs_x = -0.2, dist = -5 }, { abs_x = -0.05 } }) 8/ there is a button component for making connection for onClick to text. Write text in GUI: ------------------ x,yby,yb,w = writeTextGUI(g,text,size,x,y,font) call tis function from grafic gui hook. g - pointer to grafic context text - writed text size - real size of text in px ( size is modificated by size variable in font definition to be every text have same real size ) x,y - position of text in screen ( y is position of baseline ) font - usable values:o -- LOGtext,hwScript,AvQuest,AvQuestx,Shaken,Palantino - "standart texts" -- Angerthas_g, Angerthas_s "rune text with normal map" -- Daedra_black,Daedra_red,Daedra_yellow, "Daedra runes with 3 color for standard painting" Is possible to write different texts next to each other: local size = 40 local x,yby,yb,w x,yby,yb,w = writeTextGUI(g,"Test ",size,30,80,"Palantino") x,yby,yb,w = writeTextGUI(g,"writing ",size,x,yby,"hwScript") x,yby,yb,w = writeTextGUI(g,"for text ",size,x,yby,"Shaken") Write text in GrimTK GUI framework: ----------------------------------- ! must be correctly instaled GrimTk framework first eg. make widget: { type = "GWidget", position = {120,50}, size = {340, 40}, children = GF.script.getTextGrimTK("text",size,x,y,font), }, Creating new font definition: ----------------------------- 1/ create picture with font - its in iconatlas format. 75x75px for letter x:1024 y:320/384/512/576 ( y - size are defined for letter object ) - for creating is usefull tools: GrimrockGraphicsAtlasToolkit form Johm Wordsword or http://kvazars.com/littera/ 2/ definition variables for font - variables are stored in GraficFonts.lua in GF table atlas - path for picture of font model - path for model ( must be setted correct model for size y of picture ) keymap - string with list of chars as are in picture offset - offest definition for each char ( shorted by position of char in keymap ) - [1] - shift char to left for using left position of char - [2] - width of char - [3] - shift char to down ( for fitting each char to one position ) height - real height of A in px in picture ( is used for compute size for writen texts ) baseline - position of baseline tab - width for tab char 3/ generate materials for font -> see init.lua material deffinitions and make it simmilar ( its very bored to define font :) )