Skip to content

Add test for the Roboto "texte coupé" bug (now fixed) #110

@tinchodias

Description

@tinchodias

Add test the "texte coupé" bug reported by @ELePors and @labordep
This probably implies adding Roboto font as downloadable.

This showed the bug:

aString := 'RAD'.
fontSize := 14.
ttfFileReference := '../fonts/Roboto/Roboto-Regular.ttf' asFileReference.

aeCanvas := AeCanvas extent: 100 @ 100.
aeCanvas clear: Color white.

ftLibrary := AeFTLibrary newInitialized.
ftFace := ftLibrary newFaceFromFile: ttfFileReference index: 0.
cairoScaledFont := aeCanvas scaledFontForFace: ftFace size: fontSize.
cairoGlyphsArray := cairoScaledFont glyphArrayForString: aString.

metrics :=
	aeCanvas
		metricsFor: cairoGlyphsArray
		font: cairoScaledFont.

aeCanvas privateAeCairoContext
	translateByX: 10 y: 10;
	rectangleTo: metrics width @ metrics height;
	clip;
	sourceColor: Color yellow;
	paint.

aeCanvas
	setSourceColor: Color black;
	pathTranslate: metrics bearingX negated @ metrics bearingY negated;
	drawGlyphs: cairoGlyphsArray font: cairoScaledFont.

aeCanvas inspect.
aeCanvas writePngTo: '/tmp/a.png' asFileReference 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions