1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2024-12-26 11:28:22 +01:00
Diya-API/Diya/DiyaFontFamily.class.st

53 lines
970 B
Smalltalk
Raw Permalink Normal View History

2022-03-01 19:22:26 +01:00
Class {
#name : #DiyaFontFamily,
#superclass : #DiyaBaseObject,
#instVars : [
2022-03-04 20:28:38 +01:00
'styles',
2022-03-01 19:22:26 +01:00
'name'
],
#category : #'Diya-Fonts'
}
{ #category : #'instance creation' }
DiyaFontFamily class >> fromFace: face [
^self new addFace: face; yourself.
]
{ #category : #accessing }
DiyaFontFamily >> addFace: face [
name ifNil: [ name := face familyName ].
2022-03-15 19:11:19 +01:00
styles at: face styleName ifAbsentPut: [(DiyaFontStyle fromFace: face)].
2022-03-01 19:22:26 +01:00
]
{ #category : #initialization }
DiyaFontFamily >> initialize [
super initialize.
2022-03-04 20:28:38 +01:00
styles := Dictionary new.
2022-03-01 19:22:26 +01:00
name := nil
]
{ #category : #accessing }
DiyaFontFamily >> name [
^ name
]
{ #category : #accessing }
DiyaFontFamily >> name: anObject [
name := anObject
]
2022-03-04 20:28:38 +01:00
{ #category : #accessing }
DiyaFontFamily >> style: styleName [
^styles at: styleName ifAbsent: [^styles at: 'Regular']
]
2022-03-01 19:22:26 +01:00
{ #category : #accessing }
DiyaFontFamily >> styleNames [
2022-03-04 20:28:38 +01:00
^styles keys
]
{ #category : #accessing }
DiyaFontFamily >> styles [
^ styles
2022-03-01 19:22:26 +01:00
]