Skip to content

Use Hershey fonts for text rendering - #1983

Closed
rich257 wants to merge 2 commits into
Motion-Project:masterfrom
rich257:TextRender
Closed

rich257 wants to merge 2 commits into
Motion-Project:masterfrom
rich257:TextRender

Conversation

@rich257

@rich257 rich257 commented Nov 5, 2026

Copy link
Copy Markdown

Add implementation of Hershey fonts and Bresenham raserization algorithm to improve text rendering.

Added configuration:
text_font - name of a font file with a jhf extension, eg "rowmans"
text_font_weight - how thick to draw the text, equivalent to the boldness or stroke thickness
text_font_dir - (future impl) the folder that contains the font files

To resolve: merge; confirm licence on included code; default font directory.

Note: no font files are included, they can be downloaded from https://github.com/kamalmostafa/hershey-fonts/tree/master/hershey-fonts

@Mr-Dave

Mr-Dave commented Nov 5, 2026

Copy link
Copy Markdown
Member

Looks good. A few requests.

  1. Lets remove the po files and the motion.conf from the changes. Seems like a lot of noise in them.
  2. For the font files, downloading isn't ideal. Can the fonts package in apt be used?
  3. I'll want to change the file names. (e.g. draw_hf.cpp/draw_raster) Your choice on whether it is in the PR or I do it after merging.
  4. All the draw variables are going to go into draw_params so for the moment I'd say to just have the necessary ones added. Similar to the file name changes, I'll leave it as your choice. (I can add the draw_params in now to the master branch or submit you a PR to set the template if you want)

@rich257

rich257 commented Nov 6, 2026

Copy link
Copy Markdown
Author

I'll create a new PR with a smaller set of changes, I should not have included the po files etc

  1. Yes
  2. A misunderstanding, I did not intend end users to download the files. I have included the set there is as this is about 200kB which seems relatively insignificant but the set could be pruned. They are by default now loaded from <config_dir>/fonts/. A new font dir configuration option should be used in future.
  3. I'm not sure what you want to do about namespaces and class names, so if you are happy to do file renaming at the same time as any other naming changes.
  4. If I add the three items for now and I can refactor in to the new params subsequently

@rich257 rich257 closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants