pharo-graphics / Toplo

A widget framework on top of Bloc
MIT License
19 stars 9 forks source link

[ToLabel] Define Font Name on ToTheme #134

Closed LANDAISB closed 7 months ago

LANDAISB commented 7 months ago

I failed to set a Font with a custom ToTheme. I try this:

    self select: ToLabel asTypeSelector style: [
        self when: ToInstallLookEvent write: (self property: #'text-attributes-with-builder') with: [:e |
                        e textAttributesBuilder defaultFontName: 'Univia Pro'.
            e textAttributesBuilder fontName: 'Univia Pro'.
                        e textAttributesBuilder fontSize: 32.
                        e textAttributesBuilder foreground: (Color red).
        ].
        ]

=> Only fontSize and color are modified, the font is not changed.

With Bloc I use this: BlTextElement new text: ('lmonijqgys 8' asRopedText foreground: Color red; fontSize: 32;fontName: 'Univia Pro'). => This works

This font Univia is loaded from local directory "/assets/fonts/Univia" : AeFontManager globalInstance scanDirectory: 'assets/fonts/Univia/' asFileReference.

plantec commented 7 months ago

can you upload the full theme definition please ? use a file-out from the browser, context menu on the class, 'Extra/File Out'

LANDAISB commented 7 months ago

TestTheme.txt

This is the .st file of the custom Theme (but I rename it on .txt)

plantec commented 7 months ago

it should work now after my last commit (in Toplo:dev) The theme API has changed. Now we have :

LANDAISB commented 7 months ago

It works well now, thanks a lot.