From cd7a6ab4e6520782dea8c8c1829605eda4bc6048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marti=CC=81n=20Dias?= Date: Thu, 16 Sep 2021 21:24:01 -0300 Subject: [PATCH] Use in Cairo the same default font name as in Skia --- src/Sparta-Cairo/SpartaCairoFreetypeFontBuilder.class.st | 2 +- src/Sparta-Core/FFIExternalResourceManager.extension.st | 8 ++++---- src/Sparta-Core/SpartaFontBuilder.class.st | 6 ++++++ src/Sparta-Skia/SkiaFontBuilder.class.st | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Sparta-Cairo/SpartaCairoFreetypeFontBuilder.class.st b/src/Sparta-Cairo/SpartaCairoFreetypeFontBuilder.class.st index 9a70feda..33094d6c 100644 --- a/src/Sparta-Cairo/SpartaCairoFreetypeFontBuilder.class.st +++ b/src/Sparta-Cairo/SpartaCairoFreetypeFontBuilder.class.st @@ -12,7 +12,7 @@ SpartaCairoFreetypeFontBuilder >> build [ | aFamilyName theFallbackFonts aLogicalFont | aFamilyName := (fontList isNil or: [ fontList isEmpty ]) - ifTrue: [ StandardFonts defaultFont familyName ] + ifTrue: [ self defaultName ] ifFalse: [ fontList first ]. theFallbackFonts := fontList ifNotNil: [ diff --git a/src/Sparta-Core/FFIExternalResourceManager.extension.st b/src/Sparta-Core/FFIExternalResourceManager.extension.st index d5a28af0..471be502 100644 --- a/src/Sparta-Core/FFIExternalResourceManager.extension.st +++ b/src/Sparta-Core/FFIExternalResourceManager.extension.st @@ -1,13 +1,13 @@ Extension { #name : #FFIExternalResourceManager } { #category : #'*Sparta-Core' } -FFIExternalResourceManager >> removeResource: oldObject [ - registry remove: oldObject ifAbsent: [ ] +FFIExternalResourceManager class >> removeResource: oldObject [ + self uniqueInstance removeResource: oldObject ] { #category : #'*Sparta-Core' } -FFIExternalResourceManager class >> removeResource: oldObject [ - self uniqueInstance removeResource: oldObject +FFIExternalResourceManager >> removeResource: oldObject [ + registry remove: oldObject ifAbsent: [ ] ] { #category : #'*Sparta-Core' } diff --git a/src/Sparta-Core/SpartaFontBuilder.class.st b/src/Sparta-Core/SpartaFontBuilder.class.st index fd97fdaa..23e92ac4 100644 --- a/src/Sparta-Core/SpartaFontBuilder.class.st +++ b/src/Sparta-Core/SpartaFontBuilder.class.st @@ -76,6 +76,12 @@ SpartaFontBuilder >> defaultLanguage [ ^ 'en' ] +{ #category : #initialization } +SpartaFontBuilder >> defaultName [ + + ^ 'Helvetica' +] + { #category : #initialization } SpartaFontBuilder >> defaultSize [ ^ 14 diff --git a/src/Sparta-Skia/SkiaFontBuilder.class.st b/src/Sparta-Skia/SkiaFontBuilder.class.st index f499cb02..ca345513 100644 --- a/src/Sparta-Skia/SkiaFontBuilder.class.st +++ b/src/Sparta-Skia/SkiaFontBuilder.class.st @@ -42,7 +42,7 @@ SkiaFontBuilder >> build [ | aSpartaFontFace theFontsDictionary | aSpartaFontFace := SpartaFontFace new - familyName: (familyName ifNil: [ 'Helvetica' ]); + familyName: (familyName ifNil: [ self defaultName ]); weight: weight; stretch: stretch; style: style.