Skip to content

Commit

Permalink
Update SpartaCairoScaledFont>>#makeTextRunNoReleaseWide: [feenkcom/gt…
Browse files Browse the repository at this point in the history
  • Loading branch information
chisandrei committed May 15, 2024
1 parent b5bda27 commit d281fa1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Sparta-Cairo/SpartaCairoScaledFont.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Class {
'userToDeviceMatrix',
'options'
],
#category : 'Sparta-Cairo-Text'
#category : #'Sparta-Cairo-Text'
}

{ #category : #'instance creation' }
Expand Down Expand Up @@ -115,14 +115,21 @@ SpartaCairoScaledFont >> makeTextRunNoReleaseAscii: aString [

{ #category : #'instance creation' }
SpartaCairoScaledFont >> makeTextRunNoReleaseWide: aString [
| aBuffer aGlyphsArrayPtr aGlyphsNumPtr aStatus aGlyphsArray aGlyphsNum aTextRun |
| converter length aGlyphsArrayPtr aGlyphsNumPtr aStatus aGlyphsArray aGlyphsNum aTextRun |

aGlyphsArrayPtr := ExternalAddress new.
aGlyphsNumPtr := ByteArray new: FFIInt32 externalTypeSize.

aBuffer := UTF8TextConverter default convertToSystemString: aString.
converter := CairoUTF8Converter new.
length := converter convert: aString from: 1 to: aString size.

aStatus := self primTextToGlyphs: aBuffer length: aBuffer size glyphs: aGlyphsArrayPtr num: aGlyphsNumPtr x: 0.0 y: 0.0.
aStatus := self
primTextToGlyphs: converter buffer
length: length
glyphs: aGlyphsArrayPtr
num: aGlyphsNumPtr
x: 0.0
y: 0.0.
aStatus isSuccess
ifFalse: [ SpartaCairoError signal: aStatus ].

Expand All @@ -131,7 +138,7 @@ SpartaCairoScaledFont >> makeTextRunNoReleaseWide: aString [

aTextRun := SpartaCairoTextRun new
bits: 32;
buffer: aBuffer;
buffer: converter buffer ;
length: aGlyphsNum;
glyphs: aGlyphsArray;
scaledFont: self.
Expand Down

0 comments on commit d281fa1

Please sign in to comment.