From f9ecbf1f171ee3b78abba772c1e7c71753f03c6a Mon Sep 17 00:00:00 2001 From: Martin Dias Date: Fri, 1 Mar 2024 01:25:24 -0300 Subject: [PATCH] Double-dispatch with newCairoFontFace --- src/Alexandrie-Cairo/AeFTFace.extension.st | 8 ++++++++ src/Alexandrie-Canvas/AeCanvas.class.st | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/Alexandrie-Cairo/AeFTFace.extension.st diff --git a/src/Alexandrie-Cairo/AeFTFace.extension.st b/src/Alexandrie-Cairo/AeFTFace.extension.st new file mode 100644 index 0000000..9a499e2 --- /dev/null +++ b/src/Alexandrie-Cairo/AeFTFace.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #AeFTFace } + +{ #category : #'*Alexandrie-Cairo' } +AeFTFace >> newCairoFontFace [ + "Answer a new `AeCairoFreetypeFontFace` for rendering text according to this face." + + ^ AeCairoFreetypeFontFace newForFace: self +] diff --git a/src/Alexandrie-Canvas/AeCanvas.class.st b/src/Alexandrie-Canvas/AeCanvas.class.st index 6033306..4c12b74 100644 --- a/src/Alexandrie-Canvas/AeCanvas.class.st +++ b/src/Alexandrie-Canvas/AeCanvas.class.st @@ -619,11 +619,11 @@ AeCanvas >> restoreContextOnlyIfClipAfterwards: aBlock [ ] { #category : #'API - text' } -AeCanvas >> scaledFontForFace: aFTFace size: pointSize [ +AeCanvas >> scaledFontForFace: aFace size: pointSize [ "Answer a `AeCairoScaledFont` that corresponds to the provided face and point size." | aCairoFontFace aFontMatrix | - aCairoFontFace := AeCairoFreetypeFontFace newForFace: aFTFace. + aCairoFontFace := aFace newCairoFontFace. aFontMatrix := AeCairoMatrix newScalingByX: pointSize y: pointSize. ^ aCairoFontFace