Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/mudbrick/font.ex
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ defmodule Mudbrick.Font do
offset = normal_width - width_when_kerned
{Mudbrick.to_hex(glyph_id), offset}

{glyph_id, {:std_width, _, _, _width, _}} ->
{glyph_id, {:std_width, _, _, _, _}} ->
Mudbrick.to_hex(glyph_id)

{glyph_id, {:pos, _, _, _, _}} ->
Mudbrick.to_hex(glyph_id)
end)
end

Expand Down
9 changes: 9 additions & 0 deletions test/font_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ defmodule Mudbrick.FontTest do
end
end

test "kerned handles Japanese with :pos tuple" do
doc = Mudbrick.new(fonts: %{bodoni: bodoni_regular()})
font = Document.find_object(doc, &match?(%Font{}, &1)).value

result = Font.kerned(font, "日本語")
assert is_list(result)
assert Enum.all?(result, &(is_binary(&1) or is_tuple(&1)))
end

describe "serialisation" do
test "with descendant" do
assert %Font{
Expand Down