7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-02 00:26:45 +00:00
Commit Graph

139 Commits

Author SHA1 Message Date
Jeff Young
bf34fe625c Reduce cover types.
Also, don't use _ITEM for things that aren't EDA::ITEMs.
2025-02-19 23:43:53 +00:00
Jeff Young
5edae8250d Finish eradication of visibility flag on text items.
Import/read previously-hidden symbol/footprint
text items as hidden fields.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19875
2025-02-19 23:43:52 +00:00
Seth Hillbrand
1e6e555164 Cache based on sub/subscript
Prevents the case where we cache a font in one scale and try to use
another.  This could be contained in scaleFactor but we don't currently
prescale, so hashing on the boolean is probably easier
2025-02-06 13:26:04 -08:00
Jon Evans
42b9a9604b Fix several data races triggered by parallel library loading 2025-01-25 11:44:15 -05:00
Wayne Stambaugh
5c8f4697ca Common folder housekeeping part 1. 2025-01-12 12:06:45 -05:00
Seth Hillbrand
65d8af4483 Font caches need to account for size
Fonts are rendered from FT into a scaled output before being
triangulated.  If the original scaled output is very small, the cache
ends up being a distorted scaling when expanded to larger font sizes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18870
2025-01-10 13:03:47 -08:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Dhineshkumar S
43b1bc52db Fix switching bold option on and off alters text thickness
Currently, unselecting the bold option resets the thickness to the
standard size instead of reverting to the original thickness.
To address this, the original thickness should be preserved so it
can be restored when bold is turned off.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18975
2024-11-13 02:14:19 +00:00
Seth Hillbrand
a6b25d1ee1 Fix display of broken fonts
TTF fonts are supposed to obey a specific winding.  But sometimes they
don't, especially with garbage windows font editing programs.  If the
outline with hole winding doesn't have an outline, it is probably an
outline itself

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19010
2024-10-28 12:38:03 -07:00
Jeff Young
b549c4feec Drawing sheet can't share glyph cache entries with editors.
(They use different internal units.)

Also fixes a fialure of CAIRO_GAL to reset the fill
and stroke after drawing outline glyphs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18579
2024-08-22 12:23:21 -06:00
Seth Hillbrand
0f84ddaf39 Avoid throwing a spurious substitution warnings
If the original font is a bold singleton (not a mod on a face), then we
need to avoid the mismatch between the bold marker and the asked-for
boldness.

At the end, if the font name is the same within case differences, then
it is the same font and we should not warn
2024-07-16 09:28:07 -07:00
Seth Hillbrand
77797103f7 Add ability to embed files in various elements
Schematics, symbols, boards and footprints all get the ability to store
files inside their file structures.  File lookups now have a
kicad-embed:// URI to allow various parts of KiCad to refer to files
stored in this manner.

kicad-embed://datasheet.pdf references the file named "datasheet.pdf"
embedded in the document.  Embeds are allowed in schematics, boards,
symbols and footprints.  Currently supported embeddings are Datasheets,
3D Models and drawingsheets

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6918

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2376

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17827
2024-07-15 16:06:55 -07:00
Seth Hillbrand
11c6164934 Silence font replace warnings for libs
When loading schematics/pcbs, notification of font replacements might be
warranted but in libraries, this warning is not helpful and intrusive
2024-06-24 09:55:10 -07:00
Seth Hillbrand
bcf6b620a8 Large rework of BEZIER_POLY
Add direct handling of quadratic beziers to save compute time and number
of points.  Update cubic interpolation to reduce number of points
generated for a given smoothness

Cache data on open and used cached data to avoid multiple re-calcs

Remove minimum line length and number of segments and replace with
standard max error level.  Allows us to specify the tolerance of bezier
interpolation
2024-06-18 17:55:41 -07:00
Jeff Young
98f4e60b90 Contour cache must be sensitive to size.
(While we scale the contours afterwards, font hint
data is size-sensitive so the contours are already
size-specific.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18014
2024-05-15 23:36:57 +01:00
Jeff Young
05cdd44404 Don't assume all glyphs are outline with an outline font.
Underline and overbar may be stroke glyphs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17478
2024-03-18 22:21:01 +00:00
Jeff Young
e7abeb3c38 Cleanup. 2024-02-24 20:05:51 +00:00
Jeff Young
ffa6adec96 Add a cache for TrueType contours and triangulation data.
Also returns minimumSegmentLength to its former value as
it doesn't appear to be required to fix
https://gitlab.com/kicad/code/kicad/-/issues/11463.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16568
(cherry picked from commit 162e8962f7)
2024-02-23 16:53:29 +01:00
Jeff Young
1ff36f23b8 Clean up stale TODOs. 2024-02-05 15:49:57 +00:00
Jeff Young
de634c6f3e Generate tofu if we fail to decompose outline font glyph. 2024-02-05 15:49:57 +00:00
Jeff Young
a28f092b67 Don't cover STL types. 2024-02-05 15:49:57 +00:00
Jeff Young
8410a5e685 Coding conventions and cleanup. 2024-01-23 16:03:25 +00:00
Jeff Young
047b5f8b18 Cache for wxLocale::IsAvailable(). 2024-01-17 16:13:53 +00:00
Seth Hillbrand
42e02552ac Make outline font min segment length configurable
This was hard coded at 10IU, which was way too small for pcbnew and
still too small for schematic editor.  Instead, we set a default of 50
and allow the user to adjust (smaller for less powerful machines)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16568
2024-01-11 18:30:00 -08:00
Marek Roszko
be21c689e8 Change the __except to use the exception result codes 2024-01-05 21:03:43 -05:00
Marek Roszko
05cbfc6aca Add Windows SEH to catch fontconfig/freetype font read faults
Related https://gitlab.com/kicad/code/kicad/-/issues/16484
2024-01-05 15:23:00 -05:00
Jeff Young
68cbb820a7 performance efficiencies 2023-12-18 17:20:34 +00:00
Alex Shvartzkop
b108e7058b Fix bad outline font glyphs when ligatures apply. 2023-11-18 07:59:46 +03:00
Jeff Young
1b6048b6d5 Handle non-binary font weights.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14502
2023-11-05 14:21:13 +00:00
Marek Roszko
050f812f5e Move fontconfig to kicommon for now to de-duplicate the font cache 2023-09-24 22:58:18 -04:00
Marek Roszko
22b733209d Fail GAL on its header leaking audit
Maybe we should rethink directly accessing GAL so much, but at least 600 files didn't need GAL leaked into them due to view_overlay.h
2023-09-18 19:52:27 -04:00
jean-pierre charras
931401b5be Fix a compil issue (missing header) and a minor compil warning 2023-09-14 08:44:09 +02:00
Marek Roszko
5b9aab9070 fontconfig.cpp doesn't need pgm_base.h 2023-09-13 23:14:50 -04:00
Marek Roszko
11de95778b Unwrap the FROM_UTF8 macro in favor of direct function
The extern just gets annoying to try to export the func later. We also yeet TO_UTF8 to string_utils.h for parity.
2023-09-09 00:10:57 -04:00
Marek Roszko
f45d61ef18 OUTLINE_FONT does not need Pgm() or settings or EDA_TEXT 2023-09-06 22:12:59 -04:00
Marek Roszko
53bf7b71c6 Don't call FcInitLoadConfigAndFonts after FcInit() already happened
We are only the default global FcConfig created by calling FcInitLoadConfigAndFonts inside FcInit().
Calling FcInitLoadConfigAndFonts does nothing but creating another FcConfig option that never gets disposed or used because we use the FcConfig functions with null
2023-08-26 13:53:43 -04:00
Marek Roszko
25967b4a0f Fix font map cache access creating invalid entries (and crashes) 2023-08-26 09:24:47 -04:00
Jeff Young
778213ba8f LEGACY_FACTOR was upside-down.
(Should be 1.68/1.61, not 1.61/1.68.)
2023-08-07 14:01:58 +01:00
Jeff Young
5e112ca78e ADDED: parameterize font metrics and allow customization of overbar height. 2023-08-06 20:57:41 +01:00
Jeff Young
570978fa7f Replace larger text bboxes now that we're not using them for knockouts. 2023-05-28 18:17:24 +01:00
Jeff Young
6b0bff2f4f Formatting. 2023-05-27 22:46:02 +01:00
Jeff Young
4ed267394a Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14303
2023-05-27 01:35:40 +01:00
Jeff Young
6e127829f8 Cleanup formating and includes. 2023-05-26 18:44:33 +01:00
Seth Hillbrand
0de24bfd59 Cleanup text alignment between version 6 and 7
Version 7 text alignment changed subtly for stroke fonts from version 6.
Additionally, the output has been different between screen and plotting,
leading to offset text in plotted output relative to the text shown on
screen.

This introduces a fudge factor in FONT::getLinePositions to correct the
offset in the plotting output relative to v6.

This also changes the SCH_PAINTER and PCB_PAINTER to correct the
relative offsets between GAL and PLOTTER classes.  The source of these
offsets is atm unclear.

Fixes https://gitlab.com/kicad/code/kicad/issues/14755
2023-05-17 13:33:49 -07:00
Seth Hillbrand
72267cf9b0 Adjust stroke font output to match v6 output
Many minor tweaks were added that changed the output of the stroke font
from v5/v6.  These offsets changed the gerber output expected.  This
reverts the changes to something much closer to the v6 output.  It is
not pixel-perfect but gets very close on most texts.

Fixes https://gitlab.com/kicad/code/kicad/issues/14609
2023-05-12 12:40:41 -07:00
Jeff Young
995388fb71 Rewrite linebreaking algorithm.
Previous version was overly simplistic to deal correctly
with multiple spaces or textruns not separated by spaces.

Fixes https://gitlab.com/kicad/code/kicad/issues/14683
2023-05-05 22:32:40 +01:00
Jeff Young
7e5fedef6a Markup fixes.
1) allow escape sequences inside markup sequences
2) keep overbar when inside nested markup
3) always place overbar at full height, not sub/superscript height

Fixes https://gitlab.com/kicad/code/kicad/issues/14553

Fixes https://gitlab.com/kicad/code/kicad/issues/13449
2023-04-17 17:56:54 +01:00
Wayne Stambaugh
28776f5745 Text attributes object improvements.
* Add compare method to COLOR4D object.
* Add unit test to validate COLOR4D comparison method.
* Add missing color test in text attribute comparison method.
* Add unit test for text attribute object.
* Remove unnecessary headers from text attribute header.
* Move text attribute code into separate source file.
2023-03-29 12:53:45 -04:00
Jeff Young
7b3e01ce52 Select correct face from a .ttc file.
Fixes https://gitlab.com/kicad/code/kicad/issues/13314
2023-03-13 18:29:55 +00:00
Jon Evans
7b3fd2113c Improve sheet rendering performance
- Cache font markup parsing
- Cache SCH_SYMBOL::GetOrientation
- Don't construct new strings each time in GetDefaultFieldName
2023-03-05 17:41:46 -05:00