diff --git a/lib/FontConfig.rakumod b/lib/FontConfig.rakumod index a796b22..da10586 100644 --- a/lib/FontConfig.rakumod +++ b/lib/FontConfig.rakumod @@ -12,7 +12,7 @@ has FcPattern:D $.pattern handles = FcPattern::create(); has Bool $.configured is built; has %!store; -submethod TWEAK(:$configure, :pattern($), *%props) { +submethod TWEAK(:$configure, :pattern($), :all($), :best($), *%props) { self.configure if $configure; self{.key} = .value for %props; } diff --git a/lib/FontConfig/Raw.rakumod b/lib/FontConfig/Raw.rakumod index d66daa4..1df4778 100644 --- a/lib/FontConfig/Raw.rakumod +++ b/lib/FontConfig/Raw.rakumod @@ -79,11 +79,19 @@ class FcValue is repr('CStruct') is export is rw { } multi method store(Pointer $f, :$!type = FcTypeFTFace ) { $!u.TWEAK(:$f) } multi method store($_) { fail "don't know how to set FcValue to {.WHAT.raku}"; } - multi method COERCE($v) { + multi method COERCE(Any:D $v) { my $obj = self.new; $obj.store($v); $obj; } + multi method COERCE(Any:U $_) { + when Str { FcTypeString } + when Bool { FcTypeBool } + when Int { FcTypeInteger } + when Numeric { FcTypeDouble } + when Range { FcTypeRange } + default { FcTypeUnknown } + } method CALL-ME is rw { Proxy.new( FETCH => { $!u.get($!type) },