How do I change the font color in Love2d/Lua? I already checked the wiki and Lua tutorials.
What I need is to have bold sharp ( no antialiasing ) white and black text. The white text will be over a grey background and the black will be over a white background in the same scene which means that I might need two text styles showing at the same time. Is this possible in Love2d?
Look at the font in the screenshot below.
This is what I am trying to do but when I use Bradley Handwriting as the font type it is aliased and sort of grayish white which is extremely hard to read over a grey or white background.
I really want to use Bradly Handwriting (BRADHITC) as the font type like in the mock-up screenshot as it completes the notebook theme I am going for.
How do I change the font color?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How do I change the font color?
love.graphics.setColor.Echo wrote:How do I change the font color in Love2d/Lua?
I don't understand the rest of your question.
Help us help you: attach a .love.
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: How do I change the font color?
Download the font, put it in your project, and then use https://love2d.org/wiki/love.graphics.setFontEcho wrote:I really want to use Bradly Handwriting (BRADHITC) as the font type like in the mock-up screenshot as it completes the notebook theme I am going for.
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Re: How do I change the font color?
I used love.graphics.setFont already but the font is aliased, like it has blurry edges, and so I was wondering if I could make the font bold and also if possible remove the antialiasing ( antialiasing is a way the computer makes small images like sprites and font appear smooth by adding shading to the edges ).
and in addition to that is there a way to use two different font styles at the same time, like if I want to have a heading in Ariel Black and then the adjacent text in Times New Roman. or if I want to have a specific word colored in red how would I go about this?
and in addition to that is there a way to use two different font styles at the same time, like if I want to have a heading in Ariel Black and then the adjacent text in Times New Roman. or if I want to have a specific word colored in red how would I go about this?
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: How do I change the font color?
Fairly simple. Create two new font objects using love.graphics.newFont.Echo wrote: and in addition to that is there a way to use two different font styles at the same time, like if I want to have a heading in Ariel Black and then the adjacent text in Times New Roman. or if I want to have a specific word colored in red how would I go about this?
Then in the drawing part of your code, switch to the font you need using love.graphics.setFont
Code: Select all
function love.load()
fontA = love.graphics.newFont(font_A_path)
fontB = love.graphics.newFont(font_B_path)
end
function love.draw()
love.graphics.setFont(fontA)
-- draw some stuff
love.graphics.setFont(fontB)
-- draw some stuff
...
Re: How do I change the font color?
For non-anti-aliased fonts, you might want to try using a program to convert fonts to images like Bitmap Font Generator and using it in LÖVE as an ImageFont
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How do I change the font color?
There is also RichText, which takes care of fonts, colors, and you can even embed images in your text.
Help us help you: attach a .love.
Re: How do I change the font color?
In RichText, how do I align the text?Robin wrote:There is also [wiki]RichText[/wiki], which takes care of fonts, colors, and you can even embed images in your text.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How do I change the font color?
IIRC, it only supports left-alignment.
Help us help you: attach a .love.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests