Thirsty Panther Posted October 14, 2014 Share Posted October 14, 2014 I'm unable to change the size of the Font in Leadwerks. I originally had the problem in my own project. To remove all of my own interference I made a map with code from the Documentation Font:GetFont. To change the font size I alter this line: local font = Font:Load("Fonts/Arial.ttf",36) Changing the "36" to 12,18,24,48,60 or 72 makes no change to the size of the font. Am I doing something wrong or is it a bug? font Test.zip Quote Link to comment Share on other sites More sharing options...
macklebee Posted October 14, 2014 Share Posted October 14, 2014 are you setting the context's font after you load the font size you want? local font = Font:Load("Fonts/Arial.ttf",36) self.context:SetFont(font) Edit- On a side note, I am not sure why you uploaded a *.map file? It would be more helpful to see your script. 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...
Thirsty Panther Posted October 15, 2014 Author Share Posted October 15, 2014 Thanks for the quick reply. As stated in my OP I used the example script from the Font: Get Font documentation. function App:Start() self.window = Window:Create() self.context = Context:Create(self.window) local font = Font:Load("Fonts/arial.ttf",36) self.context:SetFont(font) font:Release() return true end function App:Loop() if (self.window:Closed() or self.window:KeyDown(Key.Escape)) then return false end self.context:SetColor(0,0,0) self.context:Clear() --Draw some centered text on the screen local text = "Leadwerks" local font = self.context:GetFont() local x = self.window:GetWidth()/2 local y = self.window:GetHeight()/2 x = x - font:GetTextWidth(text)/2 y = y - font:GetHeight()/2 self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1) self.context:DrawText(text,x,y) self.context:SetBlendMode(Blend.Solid) self.context:Sync() return true end Yes the self.context:SetFont (font) is there. My problem is changing the 36 to 60 or 72 makes no difference to the text size. Does the script work for you? Re the map file, last time I posted a question and included a script I was asked for a map Cheers Quote Link to comment Share on other sites More sharing options...
macklebee Posted October 15, 2014 Share Posted October 15, 2014 yep, the script works just fine for me. Do you get any errors/warnings? Have you tried another font? As for what you need to provide to reproduce the problem - if its model/csg/physics related then typically the model or a map will be needed; if it is something driven by code, then provide a simple example script. 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...
Thirsty Panther Posted October 15, 2014 Author Share Posted October 15, 2014 Thanks macklebee. Yeah I tried it with other fonts with no luck. I think I will reinstall as I'm having problems downloading stuff from the workshop as well. Thank for your help. Quote Link to comment Share on other sites More sharing options...
Admin Posted October 30, 2014 Share Posted October 30, 2014 Your script works fine. Please update your project as you may have an old executable. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted October 30, 2014 Author Share Posted October 30, 2014 I get it to work by placing the set font in app.lua script. Thanks for checking. 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.