ObjectProfile / Roassal2

Agile Visualization Engine for Pharo and VisualWorks
http://AgileVisualization.com
MIT License
26 stars 20 forks source link

Something weird in the way fonts are looked up #22

Closed pavel-krivanek closed 5 years ago

pavel-krivanek commented 5 years ago

Issue by bergel Tuesday Apr 18, 2017 at 16:37 GMT Originally opened as https://github.com/moosetechnology/Moose/issues/1183


Consider the following code:

v := RTView new.
lbl := RTLabel new fontName: 'Bitmap DejaVu Sans'; elementOn: 'Hello World'.
v add: lbl.
v

It produces what is shown on the screenshot.

However, what is displayed is not DejaVu Sans. E.g., compare the "e" with https://www.fontsquirrel.com/fonts/dejavu-sans ejwvyesogyaqanc7sjdhhl_xgj2aiujarmhaugp696zv-t7igadyrww-5wqwhzp1scvjfcsszem9ndnex5spxxczy6pxbjybsbtccszbvcee5uarhqid18qtqm8wwdunnnusnbd_lcos-nqqplxsanm3ir4_wtuogw

pavel-krivanek commented 5 years ago

Comment by bergel Tuesday Apr 18, 2017 at 17:05 GMT


A bit more on the font.

font := FreeTypeFont fromFile: '/Library/Fonts/Bodoni Ornaments.ttf' pointSize: 42 index: 0.

morph := StringMorph contents: 'Hello World' font: font.

morph openInWindow 
bergel commented 5 years ago

We can now do:

v := RTView new.

('/Library/Fonts/' asFileReference children first: 15) do: [ :fr |
    rawFont := FreeTypeFont fromFile: fr fullName pointSize: 10 index: 0.
    v add: (RTLabel new height: 4; rawFont: rawFont; elementOn: fr basename) ].

RTVerticalLineLayout on: v elements.
v @ RTDraggableView.
v
image