-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
unit class Font::FreeType::_Glyph is rw; | ||
|
||
use Font::FreeType::Error; | ||
use Font::FreeType::Outline; | ||
use Font::FreeType::Raw; | ||
use Font::FreeType::Raw::Defs; | ||
|
||
has $.face is required; # parent object | ||
has FT_ULong $.char-code; | ||
has FT_UInt $.glyph-index; | ||
has FT_Error $.stat; | ||
method error { Font::FreeType::Error.new: :error($!stat) } | ||
|
||
method !library(--> FT_Library:D) { $.face.ft-lib.raw; } | ||
|
||
method error { Font::FreeType::Error.new: :error($!stat) } | ||
method Str { $!char-code.chr } | ||
method name returns Str { $!face.glyph-name-from-index: $.index } | ||
method index returns UInt:D { | ||
$!glyph-index ||= $!face.raw.FT_Get_Char_Index: $!char-code; | ||
} | ||
method Str { $!char-code.chr } | ||
method is-outline { | ||
.format == FT_GLYPH_FORMAT_OUTLINE with $.raw; | ||
} | ||
|
||
method outline handles<decompose> returns Font::FreeType::Outline:D { | ||
die "not an outline glyph" | ||
unless self.is-outline; | ||
my FT_Outline:D $outline = $.raw.outline; | ||
my FT_Outline $raw = $outline.clone(self!library); | ||
Font::FreeType::Outline.new: :$raw, :$.face; | ||
} |