It seems to be impossible to find a version of OCR-B, the typeface, that actually is reliably monospaced, meaning that 10 characters, regardless of which characters, always take up the exact same space.
-
Jan Wildeboer 😷:krulorange:replied to Arby last edited byThis post is deleted!
-
Jan Wildeboer 😷:krulorange:replied to Jan Wildeboer 😷:krulorange: last edited by
The standard I am trying to implement demands "Machine readable data shall be printed in OCR-B type font, size 1, constant stroke width characters, at a fixed width spacing of 2.54 mm (0.1 in), i.e. horizontal printing density of 10 characters per 25.4 mm (1.0 in)." [1] This means that the bounding box of every character MUST be exactly 2.54mm wide. This seems to be impossible with the typefaces I currently have.
[1] ICAO9303 part 3, chapter 4.4 "Print specifications" https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf
-
MarjorieRreplied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer whenever is see 2.54mm mentioned in a spec. I know it was written by idiots (probably American).
-
Petr Tesarikreplied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer But you know how this is usually solved in practice, don't you?
Break up your text into individual glyphs and then align each glyph separately on a 2.54mm boundary… -
The Bellmanreplied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer I am interested to see how you solve this. My initial thoughts were all wrong and it’s an interesting problem that probably did not exist when the standard was created. The phrasing smells of a time before laser printers.
-
Jan Wildeboer 😷:krulorange:replied to The Bellman last edited by [email protected]
@thebellman The "usual" solution is to not use the typeface and line setting at all but generate the needed glyphs as separate SVGs (or some even make bitmaps in the screen and print resolution) with same sized bounding box that get combined programatically on the desired grid. Similar to how many programs handle emojis
-
Jan Wildeboer 😷:krulorange:replied to Petr Tesarik last edited by
@ptesarik Yes, see https://social.wildeboer.net/@jwildeboer/113797983110111857 I was hoping I could avoid that extra work, but I guess I won't
-
Jan Wildeboer 😷:krulorange:replied to MarjorieR last edited by [email protected]
@marjolica The specs are wild mixture between mm and inch, agreed. A truly global chaos Here's for example the guides and sizes for the MZR (Machine Readable Zone) on a passport. The page size is B7 (so it's metric) and the nominal dimensions are in millimetres, but everything text related is cpi (Characters Per Inch). One gets used to it
-
Jan Wildeboer 😷:krulorange:replied to Jan Wildeboer 😷:krulorange: last edited by
@ptesarik (I also note that many free OCR-B typefaces prefer rounded caps instead of the butt caps in the original. Very V.A.G. Rounded vibes
-
Gareth Kitchenreplied to Jan Wildeboer 😷:krulorange: last edited by@jwildeboer I sense that the spec was devised in the era of daisy wheels, golfballs and line printers.
-
Jan Wildeboer 😷:krulorange:replied to Gareth Kitchen last edited by [email protected]
@gruff Elegant tools from a more civilised age
-
Jan Wildeboer 😷:krulorange:replied to Jan Wildeboer 😷:krulorange: last edited by
OK. I sorta kinda solved it
- Create a textbox, fill it with 30 identical characters (I use spaces)
- Make sure all spacing is set to 0
- Now set the width of that box to the desired size (in the TD1 case 77,7mm) and take note of the character size Inkscape calculates based on that
- Set the three text lines to that character size
- Align the three text lines using the "Align Text Anchors Horizontally" option
- Resize the group again to the desired width of 77,7mm -
Jan Wildeboer 😷:krulorange:replied to Jan Wildeboer 😷:krulorange: last edited by [email protected]
For the TD2 sized documents do the same dance but with 2 lines of 36 characters each and a size of 93,3mm. For TD3 (passport) 2 lines with 44 characters and a size of 114mm. It's a pragmatic solution that delivers acceptable results for the MRZ scanners I can test with, so I consider this solved for now.
-
Xavier «X» Santolaria :verified_paw: :donor:replied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer Working on your passports counterfeiting skills?
-
Jan Wildeboer 😷:krulorange:replied to Xavier «X» Santolaria :verified_paw: :donor: last edited by
@0x58 I design and create my own documents based on the ICAO9303 standards for my own organisation, which is not a country, so it is no counterfeiting
-
Xavier «X» Santolaria :verified_paw: :donor:replied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer Practice makes perfect.
-
Jan Wildeboer 😷:krulorange:replied to Xavier «X» Santolaria :verified_paw: :donor: last edited by
@0x58 10 years of that already under my belt. But now I want to have the complete production process as Open Source.
-
Matija Šukljereplied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer, if you come up with a whole tutorial, I would be quite interested.
-
Jan Wildeboer 😷:krulorange:replied to Matija Šuklje last edited by
@hook @0x58 my last two blog posts already dive deep into the topic. Including a link to a MRZ (Machine Readable Zone) generator I made: https://jan.wildeboer.net
-
Matija Šukljereplied to Jan Wildeboer 😷:krulorange: last edited by
@jwildeboer, ah, sweet, thanks!
I guess I really should subscribe (again) to your blog’s RSS/Atom feed.