| 1 |
local hb = require("luaharfbuzz") |
| 2 |
|
| 3 |
|
| 4 |
hb.Tag.NONE = hb.Tag.new() |
| 5 |
|
| 6 |
|
| 7 |
hb.Script.COMMON = hb.Script.new("Zyyy") |
| 8 |
hb.Script.INHERITED = hb.Script.new("Zinh") |
| 9 |
hb.Script.UNKNOWN = hb.Script.new("Zzzz") |
| 10 |
hb.Script.INVALID = hb.Script.from_iso15924_tag(hb.Tag.NONE) |
| 11 |
|
| 12 |
|
| 13 |
hb.Direction.INVALID = hb.Direction.new("invalid") |
| 14 |
hb.Direction.LTR = hb.Direction.new("ltr") |
| 15 |
hb.Direction.RTL = hb.Direction.new("rtl") |
| 16 |
hb.Direction.TTB = hb.Direction.new("ttb") |
| 17 |
hb.Direction.BTT = hb.Direction.new("btt") |
| 18 |
|
| 19 |
|
| 20 |
hb.Language.INVALID = hb.Language.new() |
| 21 |
|
| 22 |
hb.shape = function(font, buf, options) |
| 23 |
options = options or { } |
| 24 |
|
| 25 |
|
| 26 |
if options.language then buf:set_language(options.language) end |
| 27 |
if options.script then buf:set_script(options.script) end |
| 28 |
if options.direction then buf:set_direction(options.direction) end |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
buf:guess_segment_properties() |
| 33 |
|
| 34 |
local features = {} |
| 35 |
|
| 36 |
|
| 37 |
if type(options.features) == "string" then |
| 38 |
for fs in string.gmatch(options.features, '([^,]+)') do |
| 39 |
local feature = hb.Feature.new(fs) |
| 40 |
if feature then |
| 41 |
table.insert(features, hb.Feature.new(fs)) |
| 42 |
else |
| 43 |
error(string.format("Invalid feature string: '%s'", fs)) |
| 44 |
end |
| 45 |
end |
| 46 |
elseif type(options.features) == "table" then |
| 47 |
features = options.features |
| 48 |
elseif options.features then |
| 49 |
error("Invalid features option") |
| 50 |
end |
| 51 |
|
| 52 |
return hb.shape_full(font,buf,features,options.shapers or {}) |
| 53 |
end |
| 54 |
|
| 55 |
|
| 56 |
hb.Buffer.HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES = hb.Buffer.CLUSTER_LEVEL_MONOTONE_GRAPHEMES |
| 57 |
hb.Buffer.HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS = hb.Buffer.CLUSTER_LEVEL_MONOTONE_CHARACTERS |
| 58 |
hb.Buffer.HB_BUFFER_CLUSTER_LEVEL_CHARACTERS = hb.Buffer.CLUSTER_LEVEL_CHARACTERS |
| 59 |
hb.Buffer.HB_BUFFER_CLUSTER_LEVEL_DEFAULT = hb.Buffer.CLUSTER_LEVEL_DEFAULT |
| 60 |
|
| 61 |
hb.Tag.HB_TAG_NONE = hb.Tag.NONE |
| 62 |
|
| 63 |
hb.Script.HB_SCRIPT_COMMON = hb.Script.COMMON |
| 64 |
hb.Script.HB_SCRIPT_INHERITED = hb.Script.INHERITED |
| 65 |
hb.Script.HB_SCRIPT_UNKNOWN = hb.Script.UNKNOWN |
| 66 |
hb.Script.HB_SCRIPT_INVALID = hb.Script.INVALID |
| 67 |
|
| 68 |
hb.Language.HB_LANGUAGE_INVALID = hb.Language.INVALID |
| 69 |
|
| 70 |
hb.Direction.HB_DIRECTION_INVALID = hb.Direction.INVALID |
| 71 |
hb.Direction.HB_DIRECTION_LTR = hb.Direction.LTR |
| 72 |
hb.Direction.HB_DIRECTION_RTL = hb.Direction.RTL |
| 73 |
hb.Direction.HB_DIRECTION_TTB = hb.Direction.TTB |
| 74 |
hb.Direction.HB_DIRECTION_BTT = hb.Direction.BTT |
| 75 |
|
| 76 |
hb.Direction.HB_DIRECTION_IS_VALID = hb.Direction.is_valid |
| 77 |
hb.Direction.HB_DIRECTION_IS_HORIZONTAL = hb.Direction.is_horizontal |
| 78 |
hb.Direction.HB_DIRECTION_IS_VERTICAL = hb.Direction.is_vertical |
| 79 |
hb.Direction.HB_DIRECTION_IS_FORWARD = hb.Direction.is_forward |
| 80 |
hb.Direction.HB_DIRECTION_IS_BACKWARD = hb.Direction.is_backward |
| 81 |
|
| 82 |
hb.Buffer.get_glyph_infos_and_positions = hb.Buffer.get_glyphs |
| 83 |
|
| 84 |
return hb |