Skip to content
ExamplesOpen editor ↗

mofutatlhaka

→ textFont()

Sets the font drawn text is written in.

mofutatlhaka(font) | mofutatlhaka(font, size)

Mofutatlhaka is “letter-kind” — the Setswana word for a font. You give it the name of a system font such as 'Georgia', 'Courier New' or 'monospace', and every later piece of text is written in it.

The default is 'sans-serif'. The fonts available are whichever ones the reader’s computer has, so 'monospace', 'serif' and 'sans-serif' are the safe ones to rely on. Loading a font from a file is tlisaMofutatlhaka.

You may pass a second number, and it does what bogoloJwaMokwalo does. Calling mofutatlhaka() with nothing returns the font in force.

NameTypeDescription
mofuta (optional)mokwaloThe name of a system font, such as 'monospace'.
bogolo (optional)paloA text size in pixels.
Three system fonts
tiro setaLoeto() {
  thalaKanefase(400, 240);
  bokamorago(242);
  tlogelaMothalo();
  tlatsaMmala(30, 40, 60);
  bogoloJwaMokwalo(24);

  mofutatlhaka('sans-serif');
  thalaMokwalo('Bopa — sans-serif', 30, 70);

  mofutatlhaka('serif');
  thalaMokwalo('Bopa — serif', 30, 135);

  mofutatlhaka('monospace');
  thalaMokwalo('Bopa — monospace', 30, 200);

  tlhalosa('Mela e meraro ya mokwalo, nngwe le nngwe ka mofutatlhaka o mongwe.');
}

thalaMokwalo, bogoloJwaMokwalo, mokgwaWaMokwalo