claudep/swiss-qr-bill

Add a font factor parameter

claudep opened this issue · 4 comments

In certain cases, the font sizes may be judged a bit too small or too large. Adding a font-factor parameter could allow the user to specify a custom scaling factor for fonts.

Good idea, looking forward to it. The definition of 1pt is defined as .3527 mm.

Just a question / remark not directly related to the core functionality. Would be nice to have a method that creates a valid CF from any number. I haven't found any solid algorithm so fare. So I ended up with this one which is very "clumsy":

def check_reference_number(reference_number):
    if reference_number.strip()[:2].upper() == "RF":
            if iso11649.is_valid(reference_number):
                ref_type = 'SCOR'
                rf = iso11649.validate(reference_number)
                return True
    return False          

customer = 100
invoice_nr = 10099
customer_invoice_nr = '%s%s' % (str(customer).zfill(6), str(invoice_nr).zfill(10))
for i in range(1000):
    rf = 'RF%d%s' % (i, customer_invoice_nr)
    if check_reference_number(rf):
        break

print(rf)

That's a good suggestion, albeit not related with this issue. Could you please create a new ticket with this content?

Would be a good opportunity to learn how this works - forgot in the meantime 😂.