2022-03-21 01:45:21 +01:00
|
|
|
Class {
|
|
|
|
#name : #DiyaFontIcon,
|
|
|
|
#superclass : #DiyaText,
|
|
|
|
#pools : [
|
|
|
|
'FT2Types'
|
|
|
|
],
|
|
|
|
#category : #'Diya-Graphics'
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaFontIcon >> data: code [
|
|
|
|
super data:(code isArray ifTrue: [ code ] ifFalse:[{code}]).
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaFontIcon >> drawText [
|
2022-03-24 22:48:41 +01:00
|
|
|
|index offset tex glyph |
|
2022-03-21 01:45:21 +01:00
|
|
|
index := 1.
|
|
|
|
tex := self texture.
|
2022-03-24 22:48:41 +01:00
|
|
|
offset := (self alignLine: self fontSize)@(self valignText: self fontSize).
|
|
|
|
data do: [ :c|
|
|
|
|
glyph := tex getGlyph: c asInteger.
|
|
|
|
(self getCharsVerticesFrom: glyph offset: offset cellh: tex cellh) do: [
|
2022-03-21 01:45:21 +01:00
|
|
|
:e| vbuffer at: index put:e.
|
|
|
|
index := index + 1
|
|
|
|
].
|
|
|
|
"offset setX: offset x + tex spacing setY: offset y"
|
|
|
|
].
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2022-08-07 20:43:16 +02:00
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaFontIcon >> fontName [
|
|
|
|
^ self ? #textIconFamily
|
2022-03-21 01:45:21 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaFontIcon >> getLinebreakIndices: delta [
|
|
|
|
self shouldNotBeCalled
|
|
|
|
]
|
|
|
|
|
2022-08-06 03:11:36 +02:00
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaFontIcon >> iconSize [
|
|
|
|
^ self fontSize
|
|
|
|
]
|
|
|
|
|
2022-03-21 01:45:21 +01:00
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaFontIcon >> initialize [
|
|
|
|
super initialize.
|
|
|
|
data := { }.
|
|
|
|
vbuffer := FFIExternalArray externalNewType: GLfloat size:24.
|
|
|
|
vbuffer autoRelease.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaFontIcon >> lastSeparatorFrom: i [
|
|
|
|
self shouldNotBeCalled
|
|
|
|
]
|
2022-08-07 20:43:16 +02:00
|
|
|
|
|
|
|
{ #category : #initialization }
|
2022-08-10 19:55:49 +02:00
|
|
|
DiyaFontIcon >> process [
|
2022-08-07 20:43:16 +02:00
|
|
|
data ifNil: [ ^self ].
|
|
|
|
bbox := Rectangle origin: 0@0 corner: ((data size) * (self fontSize) ) @ self fontSize.
|
2022-08-10 19:55:49 +02:00
|
|
|
^ super process.
|
2022-08-07 20:43:16 +02:00
|
|
|
]
|