Slastraf Posted September 11, 2015 Share Posted September 11, 2015 --Create the graphics context context=Context:Create(window,0) local font = Font:Load("Fonts/SOTRD.ttf",36) context:SetFont(font) context:SetScale(1,1) if context==nil then return end I have this in my main.lua but how do I now change the font size ? when I change the Context Scale it changes the window , too but I only want to change the font size Quote Link to comment Share on other sites More sharing options...
Einlander Posted September 11, 2015 Share Posted September 11, 2015 http://www.leadwerks.com/werkspace/page/api-reference/_/font/fontload-r43 Font:Load("Fonts/arial.ttf",36) 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 11, 2015 Share Posted September 11, 2015 Basically either load another/same font at a different size and set the context's font with it or you can set the scale of the context to change the size of an existing loaded font. Note that scaling up a font alot usually cause loss of definition on the text shape. window = Window:Create() context = Context:Create(window) local font = Font:Load("Fonts/Arial.ttf",36) local font2 = Font:Load("Fonts/Arial.ttf",72) context:SetFont(font) local x = 50 local y = 50 while window:KeyDown(Key.Escape)==false do context:SetColor(0,0,0) context:Clear() context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1) context:DrawText("Arial 36 1x1 scale",x,y) context:SetScale(2,2) context:SetColor(1,0,0,1) context:DrawText("Arial 36 2x2 scale",x+50,y+50) context:SetScale(1,1) context:SetColor(0,1,0,1) context:SetFont(font2) context:DrawText("Arial 72 1x1 scale" ,x+150,y+150) context:SetFont(font) context:SetBlendMode(Blend.Solid) context:Sync() end 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Einlander Posted September 11, 2015 Share Posted September 11, 2015 Also context scaling breaks some of the 2d draw commands Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.