[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] wx assertion failure: invalid font
From: |
Greg Chicares |
Subject: |
Re: [lmi] wx assertion failure: invalid font |
Date: |
Tue, 9 Oct 2018 21:31:12 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 10/2/18 6:41 PM, Vadim Zeitlin wrote:
> On Tue, 2 Oct 2018 17:44:43 +0000 Greg Chicares <address@hidden> wrote:
>
> GC> - When I use the original instructions to reproduce the reported problem,
> GC> a PDF is created, but some lines look wrong.
[tiny letters, weird spacing between words]
> Yes, they do, and I completely failed to notice this even though I did
> examine the generated file after my fix. And, of course, it makes perfect
> sense: if an invalid font was used before, resulting in an assert, now a
> valid but wrong font is used instead. I really should have taken time to
> stop and think about what I was doing, sorry...
>
> I'm going to take time to really understand why does the invalid or wrong
> font end up being used and I'll create another PR with a proper fix later.
Can the reason be as follows? It's just a wild guess that I arrived
at by comparing the TAG_HANDLERS for <P> and <HEADER>. This does seem
to prevent the problem for our reproducible 'sample2gpp' test case.
---------8<--------8<--------8<--------8<--------8<--------8<--------8<-------
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 9d352694..98a240b6 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -454,7 +454,14 @@ static char const* const header_cell_id =
"_lmi_page_header_id";
TAG_HANDLER_BEGIN(page_header, "HEADER")
TAG_HANDLER_PROC(tag)
{
+ // As usual, reuse the current container if it's empty.
auto container = m_WParser->GetContainer();
+ if (container->GetFirstChild())
+ {
+ // It isn't, we need to open a new one.
+ m_WParser->CloseContainer();
+ container = m_WParser->OpenContainer();
+ }
// Set a unique ID for this container to allow finding it later.
container->SetId(header_cell_id);
--------->8-------->8-------->8-------->8-------->8-------->8-------->8-------