Skip to content

Commit

Permalink
Pass on AeHbGlyphInfo and #AeHbGlyphPosition
Browse files Browse the repository at this point in the history
* Remove accessors to "private" struct members (as declated by Harfbuzz code comments)
* Clean up and refactoring to use camelCase instead of underscore in inst vars and accessors of struct.
--> Comments in fieldsDesc allow string search.
  • Loading branch information
tinchodias committed Dec 1, 2023
1 parent ec77e35 commit ab81ab3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 96 deletions.
2 changes: 1 addition & 1 deletion src/Alexandrie-Harfbuzz-Tests/AeHbBufferTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,6 @@ AeHbBufferTest >> testSimpleExample [
#(75 52 55) withIndexDo: [ :each :index |
self assert: (infos at: index) codepoint equals: each ].
#(625 557 439) withIndexDo: [ :each :index |
self assert: (positions at: index) x_advance equals: each ].
self assert: (positions at: index) xAdvance equals: each ].

]
49 changes: 3 additions & 46 deletions src/Alexandrie-Harfbuzz/AeHbGlyphInfo.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,10 @@ AeHbGlyphInfo class >> fieldsDesc [

^ #(
hb_codepoint_t codepoint
"<private> hb_mask_t mask;"
hb_mask_t mask
hb_mask_t mask "(private)"
uint32_t cluster
"/*< private >*/
hb_var_int_t var1;
hb_var_int_t var2;"
uint32 var1
uint32 var2
hb_var_int_t var1 "(private)"
hb_var_int_t var2 "(private)"
)
]
Expand Down Expand Up @@ -74,18 +67,6 @@ AeHbGlyphInfo >> codepoint: anObject [
handle unsignedLongAt: OFFSET_CODEPOINT put: anObject
]
{ #category : 'accessing - structure variables' }
AeHbGlyphInfo >> mask [
"This method was automatically generated"
^handle unsignedLongAt: OFFSET_MASK
]

{ #category : 'accessing - structure variables' }
AeHbGlyphInfo >> mask: anObject [
"This method was automatically generated"
handle unsignedLongAt: OFFSET_MASK put: anObject
]

{ #category : 'printing' }
AeHbGlyphInfo >> printOn: aStream [
Expand All @@ -99,27 +80,3 @@ AeHbGlyphInfo >> printOn: aStream [
].
]

{ #category : 'accessing - structure variables' }
AeHbGlyphInfo >> var1 [
"This method was automatically generated"
^handle unsignedLongAt: OFFSET_VAR1
]

{ #category : 'accessing - structure variables' }
AeHbGlyphInfo >> var1: anObject [
"This method was automatically generated"
handle unsignedLongAt: OFFSET_VAR1 put: anObject
]

{ #category : 'accessing - structure variables' }
AeHbGlyphInfo >> var2 [
"This method was automatically generated"
^handle unsignedLongAt: OFFSET_VAR2
]

{ #category : 'accessing - structure variables' }
AeHbGlyphInfo >> var2: anObject [
"This method was automatically generated"
handle unsignedLongAt: OFFSET_VAR2 put: anObject
]
86 changes: 37 additions & 49 deletions src/Alexandrie-Harfbuzz/AeHbGlyphPosition.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Class {
#superclass : 'FFIExternalStructure',
#classVars : [
'OFFSET_VAR',
'OFFSET_X_ADVANCE',
'OFFSET_X_OFFSET',
'OFFSET_Y_ADVANCE',
'OFFSET_Y_OFFSET'
'OFFSET_XADVANCE',
'OFFSET_XOFFSET',
'OFFSET_YADVANCE',
'OFFSET_YOFFSET'
],
#pools : [
'AeHbTypes'
Expand All @@ -30,19 +30,19 @@ AeHbGlyphPosition class >> fieldsDesc [
"

^ #(
hb_position_t x_advance
hb_position_t y_advance
hb_position_t x_offset
hb_position_t y_offset
uint32 var "<private> hb_var_int_t var;"
hb_position_t xAdvance "x_advance"
hb_position_t yAdvance "y_advance"
hb_position_t xOffset "x_offset"
hb_position_t yOffset "y_offset"
hb_var_int_t var "(private)"
)
]
{ #category : 'printing' }
AeHbGlyphPosition >> printOn: aStream [
super printOn: aStream.
#(x_advance y_advance x_offset y_offset) do: [ :each |
#(xAdvance yAdvance xOffset yOffset) do: [ :each |
aStream
space;
nextPutAll: each;
Expand All @@ -53,85 +53,73 @@ AeHbGlyphPosition >> printOn: aStream [
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> var [
AeHbGlyphPosition >> xAdvance [
"This method was automatically generated"
^handle unsignedLongAt: OFFSET_VAR
^handle signedLongAt: OFFSET_XADVANCE
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> var: anObject [
AeHbGlyphPosition >> xAdvance: anObject [
"This method was automatically generated"
handle unsignedLongAt: OFFSET_VAR put: anObject
handle signedLongAt: OFFSET_XADVANCE put: anObject
]
{ #category : 'accessing' }
AeHbGlyphPosition >> xAdvanceFrom26Dot6 [
^ self x_advance from26Dot6FractionalPoint
]

{ #category : 'accessing' }
AeHbGlyphPosition >> xOffsetFrom26Dot6 [

^ self x_offset from26Dot6FractionalPoint
^ self xAdvance from26Dot6FractionalPoint
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> x_advance [
AeHbGlyphPosition >> xOffset [
"This method was automatically generated"
^handle signedLongAt: OFFSET_X_ADVANCE
^handle signedLongAt: OFFSET_XOFFSET
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> x_advance: anObject [
AeHbGlyphPosition >> xOffset: anObject [
"This method was automatically generated"
handle signedLongAt: OFFSET_X_ADVANCE put: anObject
handle signedLongAt: OFFSET_XOFFSET put: anObject
]
{ #category : 'accessing' }
AeHbGlyphPosition >> xOffsetFrom26Dot6 [
^ self xOffset from26Dot6FractionalPoint
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> x_offset [
AeHbGlyphPosition >> yAdvance [
"This method was automatically generated"
^handle signedLongAt: OFFSET_X_OFFSET
^handle signedLongAt: OFFSET_YADVANCE
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> x_offset: anObject [
AeHbGlyphPosition >> yAdvance: anObject [
"This method was automatically generated"
handle signedLongAt: OFFSET_X_OFFSET put: anObject
handle signedLongAt: OFFSET_YADVANCE put: anObject
]
{ #category : 'accessing' }
AeHbGlyphPosition >> yAdvanceFrom26Dot6 [
^ self y_advance from26Dot6FractionalPoint
]

{ #category : 'accessing' }
AeHbGlyphPosition >> yOffsetFrom26Dot6 [

^ self y_offset from26Dot6FractionalPoint
^ self yAdvance from26Dot6FractionalPoint
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> y_advance [
AeHbGlyphPosition >> yOffset [
"This method was automatically generated"
^handle signedLongAt: OFFSET_Y_ADVANCE
^handle signedLongAt: OFFSET_YOFFSET
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> y_advance: anObject [
AeHbGlyphPosition >> yOffset: anObject [
"This method was automatically generated"
handle signedLongAt: OFFSET_Y_ADVANCE put: anObject
handle signedLongAt: OFFSET_YOFFSET put: anObject
]
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> y_offset [
"This method was automatically generated"
^handle signedLongAt: OFFSET_Y_OFFSET
]
{ #category : 'accessing' }
AeHbGlyphPosition >> yOffsetFrom26Dot6 [
{ #category : 'accessing - structure variables' }
AeHbGlyphPosition >> y_offset: anObject [
"This method was automatically generated"
handle signedLongAt: OFFSET_Y_OFFSET put: anObject
^ self yOffset from26Dot6FractionalPoint
]

0 comments on commit ab81ab3

Please sign in to comment.