documentation index ◦ reference manual ◦ function index

# renpy.register_sfont

Function: | renpy.register_sfont | (name=None, size=None, bold=False, italics=False, underline=False, filename=None, spacewidth=10, default_kern=0, kerns={}, charset=u'!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{{{!}}}~'):

This registers an SFont with the given details. Please note that size, bold, italic, and underline are all advisory (used for matching), and do not change the appearance of the font.

name - The name of the font being registered

size - The size of the font being registered

bold - The boldness of the font being registered

italics - The italicness of the font being registered

underline - The underline of the font being registered

filename - The file containing the sfont image

spacewidth - The width of a space character

default_kern - The default kern spacing between characters

kerns - A map from two-character strings to the kern that should be used between those characters

charset - The character set of the font. A string containing characters in the order in which they are found in the image.

The default character set for a SFont is:

    ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
    @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
    ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

## Example

    init:
        $ renpy.register_sfont("skyfont", 22, filename="skyfont.png", default_kern=-1)
        $ esf = Character('Eileen', color=(200, 255, 200, 255),
                          what_font="skyfont", what_size=22,
                          what_drop_shadow=(1, 1))

    esf "For even more control, Ren'Py supports SFonts."

documentation index ◦ reference manual ◦ function index