Commit Graph

20 Commits (ec1c2289e56cff542dfe0fd9b22071f4352f6a9f)

Author SHA1 Message Date
robnee 3ed151bf90 Skip image rendering in CLI rather than hard abort 2021-04-03 22:58:05 +03:00
phkahler 3d51b3949b Change default chord tolerance (to 0.1%) and maximum segments (to 20).
See the discussion in #627 for details.
2020-06-14 05:20:23 +00:00
phkahler c876104714 Make sure circles have at least 16 segments.
Before this commit, with the highest chord tolerance settings, circles
would render as octagons, which confused a lot of people. See #295.
2020-06-14 05:13:50 +00:00
whitequark 50c004b679 Add a button to hide construction entities.
Also, mark not just curves, but also points and normals derived from
construction requests as construction.

Also, don't always mark arc center point as construction just to
exclude it from chord tolerance bounding box calculation; instead,
special-case it there.
2019-05-23 16:29:00 +00:00
whitequark f324477dd0 Implement a platform abstraction for windows.
This commit removes a large amount of code partially duplicated
between the text and the graphics windows, and opens the path to
having more than one model window on screen at any given time,
as well as simplifies platform work.

This commit also adds complete support for High-DPI device pixel
ratio. It adds support for font scale factor (a fractional factor
on top of integral device pixel ratio) on the platform side, but not
on the application side.

This commit also adds error checking to all Windows API calls
(within the abstracted code) and fixes a significant number of
misuses and non-future-proof uses of Windows API.

This commit also makes uses of Windows API idiomatic, e.g. using
the built-in vertical scroll bar, native tooltips, control
subclassing instead of hooks in the global dispatch loop, and so on.

It reinstates tooltip support and removes menu-related hacks.
2018-07-17 13:31:17 +00:00
whitequark fe622a1839 Add a test for workplane request. 2017-04-21 23:03:50 +00:00
EvilSpirit 5744d1d599 Implement an image request. 2017-03-12 00:13:56 +00:00
whitequark dea573e156 Highlight normals and circle radii that have a degree of freedom. 2017-02-17 04:14:36 +00:00
whitequark 74cb1f589c Add two more points to the TTF text request.
These points can be used for constraining the width of the text
(or to the width of the text).

The main parts of the commit are:
  * TtfFont is restructured to be able to return the aspect ratio
    for a given string.
  * This aspect ratio is written to the savefile, such that even if
    the font is missing, the sketch would still be solved correctly.
  * The two additional points are constrained via perpendicularly
    to the two main points (which form a v vector).

The compatibility features are as follows:
  * When the font is missing in old files, 1:1 aspect ratio is used,
    which works for the replacement symbol anyhow.
  * When the two additional points are missing in old files, their
    would-be positions are calculated and they are moved there,
    avoiding 'jumping' of underconstrained sketches.
2016-11-02 09:22:18 +00:00
whitequark 23feb4cf8f TTF: use metrics of 'A' to determine cap height.
SolveSpace 2.0 used the height of 'A' (i.e. cap height) to determine
the reference height.
SolveSpace 2.1 completely broke that during transition to Freetype,
and used something more or less random, by using FT_Set_Char_Size
with units_per_EM.
SolveSpace 2.2 attempted to fix that, but also used something more
or less random, by using FT_Request_Size with "unit" values.

Turns out that Freetype actually doesn't have a concept of cap height
at all. It is possible to extract it from the TT_OS2 table that is
present in some TrueType fonts, but it is not present in Microsoft
fonts (the msttcorefonts ones), and for those Linux fonts in which
it is present it doesn't appear very reliable.

So instead, use the height of 'A' instead, like version 2.0 did.
This has the advantage that it is quite bulletproof, and also matches
exactly what the old files are measured against.

One downside is that fonts without an 'A' glyph would not render.
We can deal with that when it becomes a problem.
2016-11-02 08:59:33 +00:00
EvilSpirit 505f503cc3 Don't consider workplane origin point for bounding box calculation. 2016-11-02 02:43:45 +00:00
EvilSpirit 600c39db91 Don't consider arc center point for bounding box calculation. 2016-11-02 02:40:26 +00:00
whitequark cdd6174cfa tests: remove CHECK_RENDER from migrate_from_v* tests.
This is a bit slow, but more importantly creates a race condition
where e.g. a failing "normal" test will be overwritten by
a succeeding "normal_migrate_from_v20".

This shouldn't ever be a problem since saving dumps the entire
internal state, or is supposed to, at least.
2016-11-02 02:40:17 +00:00
whitequark 071a7acc9d tests: bulk add of migrate_from_v22 tests. 2016-11-02 02:33:31 +00:00
whitequark af226b2437 Fix rendering of reference axes in bottom left corner. 2016-10-11 23:32:21 +00:00
whitequark a5c7fc6ad9 Disable closed contour check in the test harness.
The check was actually half-broken from the beginning and
until df83ee4; the thick red line was rendered properly but
the error text was rendered with width 0, which by chance worked
on some GL implementations. That commit has fixed the underlying
bug but left the text line width at 0 to avoid test breakage.

This commit fixes the bug, turns off the check completely, and
updates the tests to account for breakage.
2016-10-11 23:32:12 +00:00
whitequark e462387fca Add tests to cover 95.3% of constrainteq.cpp branches. 2016-08-07 17:33:27 +00:00
whitequark 9a1ceaa5c8 Unbreak TTF metrics.
In 2.0, the distance between the points in the TTF request specified
cap height. In 2.1, that was accidentally changed to some arbitrary
value near cap height instead, due to a 72pt factor mess-up.
This commit restores the old behavior.
2016-08-01 12:31:00 +00:00
whitequark fd9ee94437 Add basic test coverage for curve sketching tools. 2016-08-01 11:31:38 +00:00
whitequark 5e63d8301e Add a simple harness for automated, headless testing.
This commit alters the build system substantially; it adds another
platform, `headless`, that provides stubs in place of all GUI
functions, and provides a library `solvespace_headless` alongside
the main executable. To cut down build times, only the few files
that have #if defined(HEADLESS) are built twice for the executable
and the library; the rest is grouped into a new `solvespace_cad`
library. It is not usable on its own and just serves for grouping.

This commit also gates the tests behind a -DENABLE_TESTS=ON CMake
option, ON by default (but suggested as OFF in the README so that
people don't ever have to install cairo to build the executable.)

The tests introduced in this commit are (so far) rudimentary,
although functional, and they serve as a stepping point towards
introducing coverage analysis.
2016-08-01 00:48:37 +00:00