Commit Graph

79 Commits

Author SHA1 Message Date
Jeff Young 27804e40e2 Go back to using space-width for tabs (instead of max-char-width).
The max-char-width impl was buggy and never applied to PCBNew anyway.
Plus the stroke font has a max-char-width of 2.8 time the space width,
so it made for really wide tab spacing.

Also fixes a bug where the Scintilla editors weren't getting a
monospace font on Mac.  (This bug may also exist on the other
platforms, but each would need its own fix.)

Also moves more of the Scintalla customizations to SCINTILLA_TRICKS
where they can be shared.

Fixes https://gitlab.com/kicad/code/kicad/issues/8666
2021-06-24 23:53:27 +01:00
Mikolaj Wielgus 2af06a9d60 Fix stroke text size calculation and bitmap text overbar
Fixes bug 1 from https://gitlab.com/kicad/code/kicad/-/issues/8591.

Fixes a bug where no overbar would appear in bitmap text.
2021-06-14 09:09:30 +00:00
Mikolaj Wielgus 63c263090f Add versioning to page layout editor worksheets 2021-06-11 18:40:57 +00:00
Mikolaj Wielgus 3d520ebe1e Replace `~...~` overbar syntax with `~{...}`
Fixes https://gitlab.com/kicad/code/kicad/issues/8134

Fixes https://gitlab.com/kicad/code/kicad/issues/4227
2021-06-11 18:40:57 +00:00
Seth Hillbrand 3d920c4088 Fix tab spacing to use widest character as ref
We had been using each 4th column of spaces.  But we needed an absolute
spacing rather than relative to the existing text to match spacing
between the input text box and our stroke font
2021-02-09 09:44:00 -08:00
Jeff Young f6aa25df52 Make bitmap text measuring cognizant of overbars.
Also adds fallback for when text contains super- or subscript.

Fixes https://gitlab.com/kicad/code/kicad/issues/6846
2021-02-07 13:59:53 +00:00
Jeff Young 5888d376a7 Handle special cases for ending overbar text.
Fixes https://gitlab.com/kicad/code/kicad/issues/6695
2020-12-10 18:38:31 +00:00
Jeff Young 0a7ef25453 Replace STROKE_FONT performance fix, this time with correct type.
Also this time with a fixed Cairo implementation and an implemented
BASIC_GAL implementation.

Fixes https://gitlab.com/kicad/code/kicad/issues/6447
2020-11-20 11:24:52 +00:00
Marek Roszko 1db882ed1b Partially revert 876b87b64e
This broke all text objects (for me on Windows at least)
2020-11-19 19:34:54 -05:00
Jeff Young 876b87b64e Minor performance fixes for PCBNew selections. 2020-11-19 17:23:02 +00:00
Jeff Young cc617b715f Implement hypertext links for intersheet references. 2020-10-02 21:18:34 +01:00
Jeff Young a0fbb79fd0 Tighten up the overbar spacing slightly.
Fixes https://gitlab.com/kicad/code/kicad/issues/5544
2020-09-08 11:02:09 +01:00
Jeff Young 1fb51d29ab Reverse interpretation of triple-tilde.
Fixes https://gitlab.com/kicad/code/kicad/issues/4396
2020-05-11 22:56:09 +01:00
Jeff Young 2b6089240a Change super/subscript syntax to ^{foo} and _{foo}. 2020-04-18 21:04:41 +01:00
Jeff Young fb00ca12d6 Performance enhancements for stroke font initialisation. 2020-03-07 18:52:30 +00:00
Jeff Young a1c2abaff5 Get rid of line-weight component of overbar height.
It's not really necessary and it messes up text highlighting.

Fixes https://gitlab.com/kicad/code/kicad/issues/3680
2020-02-03 19:35:48 +00:00
Jeff Young 5e5edd03f6 Implement super- and subscript printing and plotting for eeschema. 2020-01-10 22:32:49 +00:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Seth Hillbrand 4f4bb96f2b Suppress false warning of uninit var 2019-12-06 06:27:47 -08:00
Seth Hillbrand df75167e14 Fix ordering warning and init error for clang
The glyphs and bb pointers were reversed.
2019-12-06 04:33:50 -08:00
Seth Hillbrand ac92afcf13 Clean up compile warnings
Ratsnest did not need a reserve and then iterative emplace.  Instead, we
use resize().  Stroke font gets private vars initialized and kiway
variables that are only used in debug builds are properly scoped for
releases as well
2019-12-05 20:05:21 -08:00
Seth Hillbrand 6f8b399c5f Replace unused resize() call
Calling resize(size()) will only zero out elements that exist above the
vector size().  The memory is not freed in this case.  shrink_to_fit()
will accomplish this action (at the discretion of the library)
2019-12-05 13:21:48 -08:00
Seth Hillbrand 65ef8c1894 StrokeFont: Reserve rather than resize
Minor speedup by not double-initializing the stroke font vector.
2019-12-04 16:36:06 -08:00
Jeff Young 581dc81358 Performance optimizations for the stroke font. 2019-12-03 17:45:26 +00:00
qu1ck 695caa7dfa Make stroke font bbox calculation consistent with rendering
When rendering tabs we count them as 4 + 1 space but when calculating
bbox it is 4 spaces + '?' width, which is a bit wider.
2019-11-11 20:16:59 -08:00
Seth Hillbrand ed77f522dd Align text to 4th column correctly
Text mod calculation was off by one in alignment
2019-11-11 20:16:59 -08:00
Jeff Young 55432d9685 Fix issue with overbar processing.
Fixes: lp:1852037
* https://bugs.launchpad.net/kicad/+bug/1852037
2019-11-11 13:05:56 +00:00
Jeff Young d6e0ec2f24 Fix a couple of edge cases in text drawing.
Don't accidentally flip the x-axis glyph size when resetting after
a sub- or superscript.

Special-case three tildes in a row.  (We could also do this for
sub- and superscript, but does anyone really need a superscript
^ or a subscript?

Fixes: lp:1851657
* https://bugs.launchpad.net/kicad/+bug/1851657

Fixes: lp:1851880
* https://bugs.launchpad.net/kicad/+bug/1851880
2019-11-09 20:22:44 +00:00
Jeff Young 35c8d64f98 Add super- and subscript support to Eeschema.
Note that since the markup might exist for other reasons, it has
to be turned on with a preference setting.  (It goes through a set
of bitflags so the same architecture can be used for other markup
structures that we might want to support in the future.)

Note also that this is more about engineering nomenclature than
visual formatting.  In that respect it's more similar to overbar
than italic or bold.
2019-11-05 17:22:51 +00:00
Seth Hillbrand 6084614371 GAL: Use vector for stroke elements
deque structures have higher overhead than vectors.  Not usually
problematic, but with hundreds of thousands of characters each with only
a few strokes, the overhead becomes dominant.
2019-10-18 21:48:58 -07:00
Jeff Young 5503727d3d Fix some placement bugs with selection haloes on text.
Fixes: lp:1838841
* https://bugs.launchpad.net/kicad/+bug/1838841
2019-08-03 17:20:54 -06:00
Seth Hillbrand 541d4358b8 Handle tabs to align text visually
This processes the \t character to place the next character aligned with
the next 4-space visual column.

Fixes: lp:1769193
* https://bugs.launchpad.net/kicad/+bug/1769193
2019-07-05 12:44:21 -07:00
Jeff Young be1d6113d6 More performance enhancements.
Be more intelligent about sorting lib tree items.  (Footprint
entries, for instance, come out of an already-sorted list.)

Don't recreate menus twice when laoding Footprint Editor.

More pervasive use of WX_FILENAME to avoid expensive calls to
wxFileName::SplitPath() and string concatenation.

For POSIX kernels do all the work on the file-system side so we
don't have to keep converting back and forth between encodings.
2018-08-06 13:49:27 +01:00
Jeff Young 146ab1eb32 Small performance improvement loading stroke font. 2018-08-06 13:48:17 +01:00
Andrzej Wolski 1f6f76beb9 Fix overbar drawing for non-italic text
Overbar was always indented inward, regardless if text was italic or not.
2018-06-24 12:01:10 -04:00
Maciej Suminski 9ce768c29a Modified STROKE_FONT::ComputeStringBoundaryLimits() to process multiline strings
Removed a declaration of a not existing method (STROKE_FONT::ComputeTextLineSize()).

Fixes: lp:1747967
* https://bugs.launchpad.net/kicad/+bug/1747967
2018-03-08 10:56:34 +01:00
Maciej Suminski 602ecf7502 Fix overbar display in OpenGL canvas
Moved the code handling text overbars to a single function
(ProcessOverbars()) to replace similar pieces of code trying to do the
same thing.

Fixes: lp:1735906
* https://bugs.launchpad.net/kicad/+bug/1735906
2017-12-07 17:58:54 +01:00
jean-pierre charras fdebcd8a6d Fixes: lp:1629387 (pagelayout text sometimes shrinking)
https://bugs.launchpad.net/kicad/+bug/1629387
2016-10-06 17:19:55 +02:00
José Ignacio Romero 5832e37177 GAL: Fix offset problem in multiline text rendering
Commit BZR 6703 introduced a minor horizontal adjustment for stroke
text rendering in GAL, but the Translate() call was done before
calling Save(). So, when this function was called multiple times a
residual offset carried over to each subsequent line.

bzr 6703 = git 67982a4
2016-05-29 17:40:11 -04:00
Maciej Suminski d23a508aa3 Fixed errors introduced to STROKE_FONT class. 2016-05-02 16:15:23 +02:00
Maciej Suminski 795fd28742 Set Stroke/Fill settings for stroke font in its Draw() function. 2016-05-02 15:56:17 +02:00
Maciej Suminski b143ce6b0f Moved text settings from STROKE_FONT to GAL. 2016-05-02 15:56:12 +02:00
jean-pierre charras 67982a4851 stroke font: fine adjust of text horizontal position. edat_text: fix an issue in SetOrientation: the rotation angle is now constrained between -360 and +360 degrees.
It was previously not the case, and rotated texts outside this interval created issues in dialog_pcb_text_properties which have now validators.
2016-04-19 20:35:47 +02:00
jean-pierre charras 92ce9c1193 Rework on class EDA_TEXT and related classes and draw text functions. More work: remove useless or duplicate code (from legacy graphic text plot functions). Move basic_gal code to separate files. 2016-03-25 09:26:11 +01:00
jean-pierre charras bc699c8d8f Rework on class EDA_TEXT and related classes and draw functions. More work. Eechema: in rotate texts: redraw the full screen to avoid garbage on screen. 2016-03-23 13:16:27 +01:00
jean-pierre charras 30d72045e7 Rework on class EDA_TEXT and related classes and draw functions (Note: this is a work in progress):
* remove duplicate code between  draw functions and STROKE_FONT used in GAL. Use only  STROKE_FONT methods in draw, plot and test DRC function for texts. It remove slightly different shapes between GAL and other calculations.
* fix incorrect bounding box for texts with overbar. Especially noticeable for texts with overbar inside a copper zone in Pcbnew.
* fix a few minor other bugs related to graphic texts.
2016-03-23 08:41:47 +01:00
jean-pierre charras 99e81aeb9c Fix incorrect (too small) bounding box EDA_TEXT, noticeable when chars like j or { are used in zone fill functions.
I tried to merge some constants used both in legacy mode and gal mode (which were, before this patch, separate constants).
There is still a serious work to avoid different calculation code for the same text in draw and plot functions.
Work in progress to merge these calculation functions.
2016-03-11 13:08:34 +01:00
jean-pierre charras bb50e141f4 Pcbnew: Force visibility of items which have no option in dialogs to controle this visibility, when reading the .kicad_brd file.
these options are used in GAL mode, but the usercannot control this visibility. So if the board file does not have these visibility flags set, the GAL never show them.
Fix also a compil warning.
2015-03-26 14:20:11 +01:00
Chris Pavlina 1d2e2e555b Final solution for the text overbar problem in GAL. 2015-03-16 18:18:18 +01:00
Chris Pavlina e6db185f2e Adjusted text overbar height in GAL. 2015-03-16 16:42:45 +01:00