Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

How does 'Draw.Font' work?

draw.font API

  • Please log in to reply
3 replies to this topic

#1
ReverseMisaya

ReverseMisaya

    Advanced Member

  • Members
  • 127 posts
  • Location🔰 SPACE 🔰
So how does 'Draw.Font' work? It keeps throwing errors that the font is nil.
 
Documentation says this: 
Font = Creates a drawable Font; Input: (path, fontName)
Text = Draws a 2D Text; Input: (text, size, x, y, Color, Font)

I would assume this is correct, but it isnt.

local font = Draw.Font(FONTS_PATH, "DejaVuSans")                   --doesnt work
local font = Draw.Font(FONTS_PATH, "DejaVuSans.ttf")               --doesnt work
local font = Draw.Font(FONTS_PATH.."DejaVuSans.ttf", "DejaVuSans") --doesnt work
local font = Draw.Font(FONTS_PATH.."DejaVuSans", "DejaVuSans.ttf") --doesnt work

...and tried a lot more possibilities

-----

local color = Draw.Color(255, 255, 0, 0)
Draw.Text("Helloworld", 24, 15, 600, color, font)

Anyone with a solution?


  • 0

#2
RMAN

RMAN

    Advanced Member

  • Contributor
  • 523 posts

Color = Creates a drawable Color; Input: (a, r, g, b); Returns Color
vs
Font = Creates a drawable Font; Input: (path, fontName)

could you see the difference? Either Draw.Font doesnt return anything(which would explain your nil error) or the API is wrong (Wouldnt be the first time)

Anyway, if it doesnt return anything your best shot would be:
    local myFont = Draw.Font(FONTS_PATH.."DejaVuSans.ttf", myFont)

 

But that also wont work so it might be broken


  • 0

#3
ReverseMisaya

ReverseMisaya

    Advanced Member

  • Members
  • 127 posts
  • Location🔰 SPACE 🔰

@Feretorix please explain


  • 0

#4
Maxxxel

Maxxxel

    The One

  • Scripts Developer
  • 1,196 posts
  • LocationGuess the right City to win 10$

ever printed FONTS_PATH?


  • 1





Also tagged with one or more of these keywords: draw.font, API

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users