diff --git a/src/Alexandrie-Harfbuzz/AeHbFace.class.st b/src/Alexandrie-Harfbuzz/AeHbFace.class.st index 3b2ee13..b7dd878 100644 --- a/src/Alexandrie-Harfbuzz/AeHbFace.class.st +++ b/src/Alexandrie-Harfbuzz/AeHbFace.class.st @@ -148,15 +148,6 @@ AeHbFace >> hasPng [ hb_ot_color_has_png ( self ) ) ] -{ #category : #accessing } -AeHbFace >> newCairoFontFace [ - "Answer a new `AeCairoFontFace` for rendering text according to this face." - - ^ self unownedNewCairoFontFace - autoRelease; - yourself -] - { #category : #accessing } AeHbFace >> newHbFont [ "Answer a new `AeHbFont` from me" @@ -176,18 +167,3 @@ AeHbFace >> unitsPerEm [ uint hb_face_get_upem ( self ) ) ] - -{ #category : #accessing } -AeHbFace >> unownedNewCairoFontFace [ - "Answer a new `AeCairoFontFace` for rendering text according to this face. - - Sender is responsible of destroying the new object. - - See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-font-face-create-for-face" - - ^ self - ffiCall: #( - AeCairoFontFace - hb_cairo_font_face_create_for_face ( self ) ) - library: AeHarfbuzzCairoLibrary -] diff --git a/src/Alexandrie-Harfbuzz/AeHbFont.class.st b/src/Alexandrie-Harfbuzz/AeHbFont.class.st index 61eac2d..44596ce 100644 --- a/src/Alexandrie-Harfbuzz/AeHbFont.class.st +++ b/src/Alexandrie-Harfbuzz/AeHbFont.class.st @@ -143,17 +143,6 @@ AeHbFont >> lock [ hb_ft_font_lock_face ( self ) ) ] -{ #category : #'instance creation' } -AeHbFont >> newCairoFontFace [ - "Answer a new `AeCairoFontFace` for rendering text according to this font. - - Note that the scale of font does not affect the rendering, but the variations and slant that are set on font do." - - ^ self unownedNewCairoFontFace - autoRelease; - yourself -] - { #category : #accessing } AeHbFont >> pointSize [ "Fetches the 'point size' of a font. Zero means unset value. @@ -292,20 +281,3 @@ AeHbFont >> unlock [ void hb_ft_font_unlock_face ( self ) ) ] - -{ #category : #'instance creation' } -AeHbFont >> unownedNewCairoFontFace [ - "Answer a new `AeCairoFontFace` for rendering text according to this font. - - Note that the scale of font does not affect the rendering, but the variations and slant that are set on font do. - - Sender is responsible of destroying the new object. - - See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-font-face-create-for-font" - - ^ self - ffiCall: #( - AeCairoFontFace - hb_cairo_font_face_create_for_font ( self ) ) - library: AeHarfbuzzCairoLibrary -] diff --git a/src/Alexandrie-Harfbuzz/AeHarfbuzzCairoLibrary.class.st b/src/Alexandrie-HarfbuzzCairo/AeHarfbuzzCairoLibrary.class.st similarity index 94% rename from src/Alexandrie-Harfbuzz/AeHarfbuzzCairoLibrary.class.st rename to src/Alexandrie-HarfbuzzCairo/AeHarfbuzzCairoLibrary.class.st index 5baeac9..220e70d 100644 --- a/src/Alexandrie-Harfbuzz/AeHarfbuzzCairoLibrary.class.st +++ b/src/Alexandrie-HarfbuzzCairo/AeHarfbuzzCairoLibrary.class.st @@ -7,7 +7,7 @@ See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html Class { #name : #AeHarfbuzzCairoLibrary, #superclass : #FFILibrary, - #category : #'Alexandrie-Harfbuzz-Library' + #category : #'Alexandrie-HarfbuzzCairo' } { #category : #'accessing - platform' } diff --git a/src/Alexandrie-HarfbuzzCairo/AeHbBuffer.extension.st b/src/Alexandrie-HarfbuzzCairo/AeHbBuffer.extension.st new file mode 100644 index 0000000..593851c --- /dev/null +++ b/src/Alexandrie-HarfbuzzCairo/AeHbBuffer.extension.st @@ -0,0 +1,25 @@ +Extension { #name : #AeHbBuffer } + +{ #category : #'*Alexandrie-HarfbuzzCairo' } +AeHbBuffer >> unownedGlyphsFrom: utf8 length: utf8Length xScaleFactor: xScaleFactor yScaleFactor: yScaleFactor intoGlyphs: glyphArrayAddress num: glyphArrayLengthAddress [ + "See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-glyphs-from-buffer" + + ^ self + ffiCall: #( + void + hb_cairo_glyphs_from_buffer ( + self, + false, + double xScaleFactor, + double yScaleFactor, + double 0.0, + double 0.0, + const char *utf8, + int utf8Length, + void **glyphArrayAddress, + uint *glyphArrayLengthAddress, + nil, + nil, + nil ) ) + library: AeHarfbuzzCairoLibrary +] diff --git a/src/Alexandrie-HarfbuzzCairo/AeHbCairoFontFace.class.st b/src/Alexandrie-HarfbuzzCairo/AeHbCairoFontFace.class.st new file mode 100644 index 0000000..f5ba844 --- /dev/null +++ b/src/Alexandrie-HarfbuzzCairo/AeHbCairoFontFace.class.st @@ -0,0 +1,42 @@ +" +I am a FFI binding for a `cairo_font_face_t` provided by Harfbuzz-Cairo integration. + +A `cairo_font_face_t` represents a particular font at a particular weight, slant, and other characteristic but not size or transformation. + +See: https://harfbuzz.github.io/integration-cairo.html +See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html +See: https://www.cairographics.org/manual/cairo-cairo-font-face-t.html +" +Class { + #name : #AeHbCairoFontFace, + #superclass : #AeCairoFontFace, + #category : #'Alexandrie-HarfbuzzCairo' +} + +{ #category : #accessing } +AeHbCairoFontFace >> scaleFactor [ + "Answer the scale factor of this font face. Default scale factor is zero. + + See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-font-face-get-scale-factor" + + ^ self + ffiCall: #( + uint + hb_cairo_font_face_get_scale_factor ( self ) ) + library: AeHarfbuzzCairoLibrary +] + +{ #category : #accessing } +AeHbCairoFontFace >> scaleFactor: scaleFactor [ + "Sets the scale factor of this font face. Default scale factor is zero. + + See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-font-face-set-scale-factor" + + self + ffiCall: #( + void + hb_cairo_font_face_set_scale_factor ( + self, + uint scaleFactor) ) + library: AeHarfbuzzCairoLibrary +] diff --git a/src/Alexandrie-HarfbuzzCairo/AeHbFace.extension.st b/src/Alexandrie-HarfbuzzCairo/AeHbFace.extension.st new file mode 100644 index 0000000..5aff5af --- /dev/null +++ b/src/Alexandrie-HarfbuzzCairo/AeHbFace.extension.st @@ -0,0 +1,25 @@ +Extension { #name : #AeHbFace } + +{ #category : #'*Alexandrie-HarfbuzzCairo' } +AeHbFace >> newCairoFontFace [ + "Answer a new `AeHbCairoFontFace` for rendering text according to this face." + + ^ self unownedNewCairoFontFace + autoRelease; + yourself +] + +{ #category : #'*Alexandrie-HarfbuzzCairo' } +AeHbFace >> unownedNewCairoFontFace [ + "Answer a new `AeHbCairoFontFace` for rendering text according to this face. + + Sender is responsible of destroying the new object. + + See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-font-face-create-for-face" + + ^ self + ffiCall: #( + AeHbCairoFontFace + hb_cairo_font_face_create_for_face ( self ) ) + library: AeHarfbuzzCairoLibrary +] diff --git a/src/Alexandrie-HarfbuzzCairo/AeHbFont.extension.st b/src/Alexandrie-HarfbuzzCairo/AeHbFont.extension.st new file mode 100644 index 0000000..a5b3e0a --- /dev/null +++ b/src/Alexandrie-HarfbuzzCairo/AeHbFont.extension.st @@ -0,0 +1,29 @@ +Extension { #name : #AeHbFont } + +{ #category : #'*Alexandrie-HarfbuzzCairo' } +AeHbFont >> newCairoFontFace [ + "Answer a new `AeCairoFontFace` for rendering text according to this font. + + Note that the scale of font does not affect the rendering, but the variations and slant that are set on font do." + + ^ self unownedNewCairoFontFace + autoRelease; + yourself +] + +{ #category : #'*Alexandrie-HarfbuzzCairo' } +AeHbFont >> unownedNewCairoFontFace [ + "Answer a new `AeHbCairoFontFace` for rendering text according to this font. + + Note that the scale of font does not affect the rendering, but the variations and slant that are set on font do. + + Sender is responsible of destroying the new object. + + See: https://harfbuzz.github.io/harfbuzz-hb-cairo.html#hb-cairo-font-face-create-for-font" + + ^ self + ffiCall: #( + AeHbCairoFontFace + hb_cairo_font_face_create_for_font ( self ) ) + library: AeHarfbuzzCairoLibrary +] diff --git a/src/Alexandrie-HarfbuzzCairo/package.st b/src/Alexandrie-HarfbuzzCairo/package.st new file mode 100644 index 0000000..4281eb6 --- /dev/null +++ b/src/Alexandrie-HarfbuzzCairo/package.st @@ -0,0 +1 @@ +Package { #name : #'Alexandrie-HarfbuzzCairo' }