PLAYGROUND (experimental)

Font, text, police... Rooooxaaannne !

Quelques évolutions dans la gestion des polices, du fait de changement de librairie graphique.

Qui permet d'être plus souple et efficace, mais m'a conduit à renommer plusieurs fonctions pour plus de clarté.

Font, Text

C'est pourtant un grand classique, il y a les font pour ce qui concerne la police de caractères, et il y a text pour ce que l'on écrit.

On pourrait s'arrêter là...

Du coup il faut prendre du recul, et utiliser le bon vocabulaire, et nommer les fonctions en conséquence.

Alors:

  • font_size permet de changer la taille
  • load_font pour charger la police (au lieu de l'ancien load_text)
  • text_align permet de changer l'alignement du texte
  • text_line_spacing permet de changer l'interlignage du texte (ou des lignes, du coup...)
  • etc.

A noter que si je me lance dans la possibilité de charger plusieurs polices en même temps, un font_face fera sans doute son apparition...

Les fonctions ?

Et du coup, l'ensemble des fonctions (qui peut évoluer...)

  • font_border() Set the global thickness of a for font border
  • font_fill() Set the global fill color for font
  • font_size() Set size of text globaly. If no value, return current size.
  • font_stroke() Set the global border color for font
  • font_default() Set font-face using an embeded font at a given size
  • load_font() Loads a font file (ttf, otf) at a given size from the specified folder or the system font directories, and makes it active for subsequent text() calls.
  • text() Draws text using the font previously loaded with load_font()
  • text_align() Set alignment of text globaly. You can use START, MIDDLE, END.
  • text_contours() Convert text to polygon contours (list of coordinate)
  • text_line_spacing() Set line spacing of text globaly. If no value, return current line spacing.
  • text_lower() Converts a string to lowercase
  • text_upper() Converts a string to uppercase
  • text_wrap() Draws text using the font previously loaded with load_font(), wrap at a certain distance