Elixir 1.17 warnings
Seeing the flowing warnings with the new Elixir v1.17
warning: using map.field notation (without parentheses) to invoke function Pdf.Font.Helvetica.name() is deprecated, you must add parentheses instead: remote.function()
(pdf 0.6.3) lib/pdf/fonts.ex:110: Pdf.Fonts.lookup_font/2
(pdf 0.6.3) lib/pdf/fonts.ex:24: Pdf.Fonts.do_get_font/4
(stdlib 6.0) gen_server.erl:2209: :gen_server.try_handle_call/4
(stdlib 6.0) gen_server.erl:2238: :gen_server.handle_msg/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
warning: using map.field notation (without parentheses) to invoke function Pdf.Font.Helvetica.name() is deprecated, you must add parentheses instead: remote.function()
(pdf 0.6.3) lib/pdf/font.ex:164: Pdf.Font.to_dictionary/2
(pdf 0.6.3) lib/pdf/fonts.ex:118: Pdf.Fonts.load_font/2
(pdf 0.6.3) lib/pdf/fonts.ex:24: Pdf.Fonts.do_get_font/4
(stdlib 6.0) gen_server.erl:2209: :gen_server.try_handle_call/4
(stdlib 6.0) gen_server.erl:2238: :gen_server.handle_msg/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
warning: using map.field notation (without parentheses) to invoke function Pdf.Font.Helvetica.name() is deprecated, you must add parentheses instead: remote.function()
(pdf 0.6.3) lib/pdf/fonts.ex:126: Pdf.Fonts.load_font/2
(pdf 0.6.3) lib/pdf/fonts.ex:24: Pdf.Fonts.do_get_font/4
(stdlib 6.0) gen_server.erl:2209: :gen_server.try_handle_call/4
(stdlib 6.0) gen_server.erl:2238: :gen_server.handle_msg/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
warning: using map.field notation (without parentheses) to invoke function Pdf.Font.Helvetica.name() is deprecated, you must add parentheses instead: remote.function()
(pdf 0.6.3) lib/pdf/page.ex:237: anonymous fn/5 in Pdf.Page.annotate_attributed_text/3
(elixir 1.17.1) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(pdf 0.6.3) lib/pdf/table.ex:189: Pdf.Table.chunk_col/2
(pdf 0.6.3) lib/pdf/table.ex:183: Pdf.Table.chunk_cols/2
(pdf 0.6.3) lib/pdf/table.ex:177: Pdf.Table.chunk_rows/5
(pdf 0.6.3) lib/pdf/table.ex:40: Pdf.Table.table/5
(pdf 0.6.3) lib/pdf/document.ex:125: Pdf.Document.table/5
(pdf 0.6.3) lib/pdf.ex:529: Pdf.do_table/6
(stdlib 6.0) gen_server.erl:2209: :gen_server.try_handle_call/4
(stdlib 6.0) gen_server.erl:2238: :gen_server.handle_msg/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
...warning: using map.field notation (without parentheses) to invoke function Pdf.Font.Helvetica.name() is deprecated, you must add parentheses instead: remote.function()
(pdf 0.6.3) lib/pdf/page.ex:467: anonymous fn/2 in Pdf.Page.print_attributed_line/2
(elixir 1.17.1) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
(pdf 0.6.3) lib/pdf/page.ex:448: Pdf.Page.print_attributed_lines/8
(pdf 0.6.3) lib/pdf/page.ex:308: Pdf.Page.text_wrap/5
(pdf 0.6.3) lib/pdf/table.ex:338: Pdf.Table.draw_row/4
(pdf 0.6.3) lib/pdf/table.ex:299: Pdf.Table.draw_table/5
(pdf 0.6.3) lib/pdf/table.ex:22: Pdf.Table.table/5
(pdf 0.6.3) lib/pdf/document.ex:125: Pdf.Document.table/5
(pdf 0.6.3) lib/pdf.ex:529: Pdf.do_table/6
(stdlib 6.0) gen_server.erl:2209: :gen_server.try_handle_call/4
(stdlib 6.0) gen_server.erl:2238: :gen_server.handle_msg/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Thanks for the bug report and attempted fix but the issue is a bit more complex than that. In fact the underlying implementation relies on the fact that module.name can be a function call or a field access because external fonts are struct instances with fields and internal fonts are modules with functions.
This has other problems so I’m going to have to work on a better implementation to fix this properly.
@andrewtimberlake Are you working on the new implementation to fix the warning?
Any updates? Elixir 1.18 is about to come out soon and backward compatibility for this may be removed.
Hi @kevinkirkup thanks for following up I have just merged changes that should resolve this https://github.com/andrewtimberlake/elixir-pdf/commit/3e24670a001a3021cb23bc8315937389db9004ce The tests pass and I’ve run it against my project that uses the library. I’d appreciate it if you could test before I push out a release ping @dinhhuydh, @Hermanverschooten
Hey @andrewtimberlake I tried the new version on 2 projects that heavily use PDF's and both work. No more warnings and compile time went down by about 50%! great work!
Thanks for checking for me @Hermanverschooten
I also checked. The warnings are gone and the fonts in my pdf still work. 👍
Thanks everyone. I have released 0.7.2
It works on my project. Thank for your work @andrewtimberlake.