New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement stroke texts for footprints and boards #246

Merged
merged 11 commits into from Apr 18, 2018

Conversation

Projects
None yet
2 participants
@ubruhin
Member

ubruhin commented Apr 5, 2018

Note: There are still some open questions to clarify before this is ready to merge. But here already an explanation about this new feature:

board

Stroke Font

Until now we used TrueType fonts in footprints/boards, but they cannot be exported into the Gerber format without extremely high effort. So we need stroke fonts (like most CAD/EDA applications). But because we were not happy with existing stroke font technologies, we started to develop specifications for a new stroke font: https://github.com/fontobene/fontobene/blob/master/SPECIFICATION.md

As these specifications will be ready soon, I started to implement them in LibrePCB. They can now be used in footprints and boards. Schematics still use TrueType fonts as no Gerber export is required.

Application Font Pool

Now the application has a directory where FontoBene files are located. They are loaded at runtime, so they need to be deployed together with the application. The library editor uses the default application font when editing footprints.

Project Font Pool

To remove the dependency of projects/boards to the application-wide fonts (and thus make projects even more self-contained), projects copy the application-wide fonts into the directory resources/fontobene inside the project's directory. This is done only once, afterwards boards of a project will only use these project-wide fonts. Changing application-wide fonts will thus have no effect on all existing projects. That's important to not break boards when updating the application (and its fonts) to a newer version.

In addition, this even allows users to use other fonts for their boards :) Other EDA tools do not provide this flexibility as fonts are often strongly bundled with the application.

Default Board Font

Currently there is only one font available, but in future we may provide various fonts and allow the user to specify what font should be used for every text object placed on a board. So we need to specify which one is the default font. That's now a property of every board, so you can choose the default font for every board separately.

Board Text Objects

Users can now place standalone text objects on boards:

demo brushless controller lpp - librepcb board editor_021

To modify these text objects, there's a property dialog:

demo brushless controller lpp - librepcb board editor_022

Footprint Text Objects

Footprints (in the library) typically contain text objects for name and value. When adding a footprint to a board, all its contained text objects are now copied as separate text objects (not just referenced), decoupled from the footprint. The original footprint text objects are not shown in a board. This way the decoupled text objects can be modified (e.g. moved/rotated) separately.

auswahl_023

Footprint texts can also be removed from a board if not used. Maybe some time we can add a "lock text objects" property to footprints to avoid accidentally removing or modifying text objects.

Board File Changes

In the demo workspace you can see what has changed in the board file: LibrePCB/demo-workspace@94942f5#diff-8482b174ff3f28dcc855f119f2294404

Of course a board file is now a lot larger. But I think that's worth it...

Feedback?

Feedback is very welcome! You can already check this branch out to test the new features. It's not too late to make some changes 馃槈

Fixes #165.

@ubruhin ubruhin added the enhancement label Apr 5, 2018

@ubruhin ubruhin added this to the 0.1 milestone Apr 5, 2018

@ubruhin ubruhin self-assigned this Apr 5, 2018

@dbrgn

This comment has been minimized.

Contributor

dbrgn commented Apr 5, 2018

Great work @ubruhin! Looking good.

I like this font btw. Kudos to the LibreCAD developers, upon whose work the FontoBene format (and the "unicode" font) is based (I think mostly @Rallaz, maybe also @dxli or @lordofbikes).

@ubruhin

This comment has been minimized.

Member

ubruhin commented Apr 7, 2018

Update:

  • Rebased to master
  • Use absolute stroke width instead of a ratio (e.g. 0.2mm instead of 20%)
  • Add stroke width to letter spacing (adjust letter spacing dynamically to stroke width)
@ubruhin

This comment has been minimized.

Member

ubruhin commented Apr 12, 2018

Update:

  • Rebased to master
  • Fixed several issues
  • Use automatic line spacing (line spacing specified by font plus stroke width)
  • Allow to manually override letter spacing and line spacing (ignoring values provided by font):
    stroke text properties_010

Now we "only" need a font with a suitable license to finish this feature...

@ubruhin

This comment has been minimized.

Member

ubruhin commented Apr 15, 2018

Update: Switch font to "FontoStroke" (converted NewStroke, see fontobene/fontobene-fonts#4) because of the unknown license situation of the LFF fonts. NewStroke has CC0 license, so it can be used for any purpose.

@ubruhin ubruhin changed the title from WIP: Implement stroke texts for footprints and boards to Implement stroke texts for footprints and boards Apr 15, 2018

@ubruhin

This comment has been minimized.

Member

ubruhin commented Apr 15, 2018

Fixed some issues encountered in the new font (fontobene/fontobene-converters#3) and renamed "FontoStroke" to "NewStroke Bene" (fontobene/fontobene-fonts#4).

I think now it should be ready to merge.

@dbrgn

This comment has been minimized.

Contributor

dbrgn commented Apr 15, 2018

I can do some testing tomorrow.

@dbrgn

This comment has been minimized.

Contributor

dbrgn commented Apr 16, 2018

Seems to work great, unless you add too many characters :) Probably some algorithm with exponential runtime. Would be worth profiling.

@ubruhin

This comment has been minimized.

Member

ubruhin commented Apr 16, 2018

Thanks for testing! Yeah performance improvements could be done later if really needed...

@ubruhin ubruhin merged commit 0385957 into master Apr 18, 2018

4 checks passed

continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@ubruhin ubruhin deleted the fontobene branch Apr 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment