Commit Graph

37 Commits

Author SHA1 Message Date
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
Seth Hillbrand 81256c0fa4 Prevent mutex deadlock
The overbar function in outline fonts recursively calls the text
function which already owns the lock.  To avoid this, we have an
unlocked variant that is wrapped by the exposed text function

Fixes https://gitlab.com/kicad/code/kicad/issues/14015
2023-02-23 14:59:59 -08:00
Mark Roszko 7b4abb1f7b FT_Face is also not thread, protect getTextAsGlyphs 2023-02-17 14:39:52 +00:00
Marek Roszko 65d5b34da3 freetype is not thread safe, zone filler can trigger multi-thread access
sentry KICAD-B1

https://freetype.org/freetype2/docs/reference/ft2-base_interface.html
[Since 2.5.6] In multi-threaded applications it is easiest to use one FT_Library object per thread.
In case this is too cumbersome, a single FT_Library object across threads is possible also, as long as a mutex lock is used around FT_New_Face and FT_Done_Face.
2023-02-17 07:26:52 -05:00
Marek Roszko e8e407dfba It's not impossible for the font face to fail loading
LoadFont()'s only usage already checked for nullptr to fallback, let's actually return nullptr on a failed load

Fixes sentry KICAD-8Z
Make the cause of sentry KICAD-95
2023-02-13 20:09:05 -05:00
Seth Hillbrand bcc1e28bab Fix Windows build error
bc Microsoft owns all the words
2023-01-25 16:45:04 -08:00
Seth Hillbrand cf52bfcc55 Handle missing Bold/Ital outline fonts
If the font face doesn't include a Bold or Italic version, we still want
to display the font as bold/italic, so we fake it with freetype.

This also prevents recurring error messages where the outline font warns
about "substitutes" within the same font family.

Also allows variants on the weight descriptor to be used without
throwing a substitution warning

Fixes https://gitlab.com/kicad/code/kicad/issues/13654
2023-01-25 13:13:38 -08:00
Marek Roszko ac94995f70 Some more wxS 2023-01-16 19:07:50 -05:00
Jeff Young aeb0d1d887 Use a more reliable conversion to UTF8.
Fixes https://gitlab.com/kicad/code/kicad/issues/12722

Fixes https://gitlab.com/kicad/code/kicad/issues/13313
2023-01-07 13:13:13 +00:00
Jeff Young 387f1214f0 Add some heuristics to guess a better font overbar offset.
Fixes https://gitlab.com/kicad/code/kicad/issues/13010
2022-11-26 17:26:20 +00:00
Ian McInerney 1683e552f7 Add/fix some variable initializations 2022-09-25 00:48:38 +01:00
jean-pierre charras bde2d388f1 Fix a very serious memory leak in OUTLINE_FONT::getTextAsGlyphs(). 2022-09-13 17:55:12 +02:00
Jeff Young 9188838e50 RIP EDA_RECT. 2022-08-31 23:57:24 +01:00
Jeff Young 560dc7d2b6 Underline for hypertext rollovers. 2022-08-27 23:58:13 +01:00
jean-pierre charras 32551cf1ea minor coding style fix. 2022-07-31 18:35:37 +02:00
jean-pierre charras 9f38fa43cd Fix some minor compil and Coverity warnings. 2022-06-05 11:44:49 +02:00
Jeff Young 662c1ce88f Improve outline font overbar metrics. 2022-04-26 12:52:29 +01:00
Jeff Young 9b6a10fa6a Fix mirrored overbars.
Also fixes a bug that we'd render too many glyphs when some glyphs
were combined.  (To test, render "text" in Apple Chancery.  The opening
"te" is combined into a ligature after which we render an extra 't' at
the end.

Fixes https://gitlab.com/kicad/code/kicad/issues/11441
2022-04-23 14:21:12 +01:00
Jeff Young fb1e1aec9a Add tab processing for outline fonts. 2022-04-20 12:00:19 +01:00
Ola Rinta-Koski 6196f2bdf0 Version info: report all font libraries 2022-03-07 14:01:37 +00:00
Jeff Young 5ce559176d Overhaul the font metrics calcs for overbar, italics and bboxes. 2022-02-07 17:36:40 +00:00
Marek Roszko 18eda73f60 Initialize m_face in constructor PVS V730 2022-02-05 11:36:02 -05:00
Jeff Young 5739505aa3 TextBoxes for PCBNew. 2022-01-31 20:00:47 +00:00
Jeff Young c6a8100d46 Schematic and symbol text boxes.
Also fixes some plot bugs with arcs.

Also moves polygonization of arcs (when required) in plotting code
from 5 degrees to calculated based on ARC_HIGH_DEF.

Fixes https://gitlab.com/kicad/code/kicad/issues/5017
2022-01-28 21:38:15 +00:00
Jeff Young 6dc8cd3f18 Add FreeType version to version info.
Fixes https://gitlab.com/kicad/code/kicad/issues/10393
2022-01-21 13:21:21 +00:00
Ola Rinta-Koski da65fe0469 Font outline decomposition fixes 2022-01-15 12:51:09 +00:00
Jeff Young 70ad554343 Coverity fixes. 2022-01-14 16:08:18 +00:00
Jeff Young 8f7d2dd06a More VECTOR2D -> VECTOR2I and wxPoint cleanup. 2022-01-11 14:20:14 +00:00
Jeff Young 7d032f9c2f Outline font rendering for Cairo, plotter, printer and 3D viewer.
Fixes https://gitlab.com/kicad/code/kicad/issues/10319
2022-01-10 01:54:28 +00:00
Jeff Young 78cac128b7 Careful: symbol fonts have no language.
Also a bit of clean up to shut up a false-positive in Coverity (and
clangd) on dereferencing a possibly (not) nullptr.
2022-01-09 11:34:20 +00:00
Jeff Young a4349ae638 Cleanup and error reporting for fonts. 2022-01-09 11:34:20 +00:00
Jeff Young 04c76f10e9 Performance enhancements for fonts. 2022-01-08 16:47:45 +00:00
Jeff Young 438c63f587 Fix outline font boundingbox issues. 2022-01-08 16:47:45 +00:00
Jeff Young eb58d7e44c Text glyph caches and bug fixes.
1) Unify metrics between stroke and outline fonts
2) Unify handling of rotation and mirroring
3) Bug fixes in collision handling
4) Use of VECTOR2I (instead of VECTOR2D) for world-coordinates
5) Generate outline font overbar with rounded ends and fix rotation
bugs
6) Generate wxEVT_CHOICE events from FONT_CHOICE::SetFontSelection
7) Change text-item PNS SOLIDs to use compound shapes
2022-01-08 16:47:45 +00:00
Ola Rinta-Koski 5b7198dfc8 Fixes as per @sethhillbrand's comments 2022-01-08 16:47:45 +00:00
Jeff Young a2030a5956 GUI for font selection. 2022-01-08 16:47:45 +00:00
Ola Rinta-Koski 9b406c1da4 Outline font support. 2022-01-08 16:47:45 +00:00