solvespace/src
ruevs e07b082eb8 Fix hang when trying to display characters missing from the embedded font
When SolveSpace tries to display an Unicode code point (e.g. U+EA00 )
that does not exist in the embedded vector font (unifont.hex.gz) it hangs
in an endless loop in
`const BitmapFont::Glyph &BitmapFont::GetGlyph(char32_t codepoint)`.

The reason is that the binary search through the text file unifont-8.0.01.hex
that does the "lazy loading" of glyphs does not end.

Here is a short excerpt from the file:

```
D7FE:00007FFE63866DF66DEE6DDE63DE7FFE7FFE61866FBE638E6FBE6F867FFE0000
D7FF:00007FFE63866DF66DEE6DDE63DE7FFE7FFE61866FBE638E6FBE6FBE7FFE0000
F900:0080108810881FF8100800007FFE00000FF008100FF00810042002447FFE0000
F901:00047FFE008010841FFE10841FFC10841FFC10840880050003000CC0703E0000
```

When searching for `0xEA00` after some iterations of the while loop
2450010bbf/src/resource.cpp (L567)
both `first` and `last` end up pointing to F900. After that on each
consecutive iteration of the loop `last` ends up pointing to the LF (0x0A)
just before F900
2450010bbf/src/resource.cpp (L585)
and then `mid` ends up back on F900 here
2450010bbf/src/resource.cpp (L570)
and this will repeat enlessly.

The solution is to do
```
                    first++;
```
here
2450010bbf/src/resource.cpp (L591),
which will make `first==last` and change whe while loop contition to `while(first < last) {` thiw will
allow the while loop to exit.

Tested with
- 0xEA00 - non existent, not found in 16 iterations.
- 0xF900 - exists but takes exactly 16 iterations of the binary search to finish
- 0x0000 - found in 16 iterations
- 0xFFFD - the replacement Unicode code point for non-existing glyphs. Also the end of the font.
- 0xFFFFF - a codepoint beyond the end, not found and does not cause an exception

The lazy parsing of the vector front was introduced here.
645c2d90ac

Fixes #1150
2021-12-21 09:49:08 -05:00
..
platform mac: Don't interpret single-touch scroll events as pan gestures 2021-12-10 10:25:13 -05:00
render Skip image rendering in CLI rather than hard abort 2021-04-03 22:58:05 +03:00
srf Fix various typos 2021-07-06 10:37:58 -04:00
CMakeLists.txt Fix/silence mac build warnings 2021-08-14 20:34:26 -04:00
bsp.cpp Intersection boolen in triangle mesh mode is properly implemented 2020-05-10 17:11:19 -04:00
clipboard.cpp Fix various typos 2021-07-06 10:37:58 -04:00
config.h.in Drop backtrace generation. 2020-07-28 14:56:55 +00:00
confscreen.cpp + safe height gcode parameter 2021-10-23 20:01:29 -04:00
constraint.cpp Addition of ArcLength Ratio and ArcLength Difference constraints to Constraints list 2021-06-28 11:31:53 -04:00
constrainteq.cpp Addition of ArcLength Ratio and ArcLength Difference constraints to Constraints list 2021-06-28 11:31:53 -04:00
describescreen.cpp UI: Show XYZ distance components in the text window for two points 2021-03-06 14:15:28 -05:00
draw.cpp Use Range-based for Loops Instead of NextAfter for all IdList Objects 2021-05-12 19:50:23 -04:00
drawconstraint.cpp Add "Show Exploded View" menu option 2021-08-17 17:48:25 +03:00
drawentity.cpp Add "Show Exploded View" menu option 2021-08-17 17:48:25 +03:00
dsc.h Remove all unused methods from IdList and its iterator 2021-05-12 19:50:23 -04:00
entity.cpp Fix issue659 - Problems constraining to ends of Helix. 2020-08-07 15:16:47 -04:00
export.cpp Clamp lighting value on export to fix flat colors 2021-04-02 18:13:31 -04:00
exportstep.cpp Use Range-based for Loops Instead of NextAfter for all IdList Objects 2021-05-12 19:50:23 -04:00
exportvector.cpp + safe height gcode parameter 2021-10-23 20:01:29 -04:00
expr.cpp Use the new equality/inequality operators of handles to reduce references to .v. NFC. 2019-07-10 15:40:21 +00:00
expr.h Clean up virtual, override, default, and void params. NFC. 2019-09-11 10:31:07 +00:00
file.cpp fix STL linking issue. Model was disappearing after the link group. 2021-11-20 19:48:17 -05:00
generate.cpp Add "Show Exploded View" menu option 2021-08-17 17:48:25 +03:00
graphicswin.cpp GUI: Flexible vertical space above the toolbar 2021-11-04 20:08:54 -04:00
group.cpp Correct which group is forced to mesh when linking an STL file 2021-08-24 13:09:19 -07:00
groupmesh.cpp Use Range-based for Loops Instead of NextAfter for all IdList Objects 2021-05-12 19:50:23 -04:00
importdxf.cpp Allow DXF import of 3D arcs and circles 2020-10-01 12:59:43 -04:00
importidf.cpp Fix various typos 2021-07-06 10:37:58 -04:00
importmesh.cpp Correct which group is forced to mesh when linking an STL file 2021-08-24 13:09:19 -07:00
lib.cpp Addition of ArcLength Ratio and ArcLength Difference constraints to Constraints list 2021-06-28 11:31:53 -04:00
mesh.cpp Fix #696. Account for multiple coincident edges when looking for naked edges. 2020-09-14 12:07:17 -04:00
modify.cpp Use Range-based for Loops Instead of NextAfter for all IdList Objects 2021-05-12 19:50:23 -04:00
mouse.cpp mac: Support for pan, zoom and rotate trackpad gestures (#1093) 2021-08-27 01:58:33 +02:00
polygon.cpp Less work in AssembleContour 2020-05-06 18:38:58 -04:00
polygon.h Add a pass in triangulation to create convex triangle fans. These triangles will have smaller bounding boxes and look better. 2020-08-07 15:47:01 -04:00
polyline.cpp Make some arguments const/const references, where possible. NFC. 2019-11-23 14:07:31 +00:00
request.cpp Use the new equality/inequality operators of handles to reduce references to .v. NFC. 2019-07-10 15:40:21 +00:00
resource.cpp Fix hang when trying to display characters missing from the embedded font 2021-12-21 09:49:08 -05:00
resource.h Various header cleanups. NFC. 2020-05-10 09:24:12 +00:00
sketch.h Correct which group is forced to mesh when linking an STL file 2021-08-24 13:09:19 -07:00
solvespace.cpp + safe height gcode parameter 2021-10-23 20:01:29 -04:00
solvespace.h + safe height gcode parameter 2021-10-23 20:01:29 -04:00
style.cpp Fix MmToString calls that should have editable=true set 2021-08-15 18:18:41 -04:00
system.cpp Make the redundant constraint timeout a configuration value and add the config UI elements to edit that value. 2020-09-16 16:39:43 -04:00
textscreens.cpp Correct which group is forced to mesh when linking an STL file 2021-08-24 13:09:19 -07:00
textwin.cpp Darken disabled gray to 50% and document it. 2021-08-21 20:19:30 -04:00
toolbar.cpp GUI: Flexible vertical space above the toolbar 2021-11-04 20:08:54 -04:00
ttf.cpp Don't show unusable fonts in font selector. 2019-11-23 16:17:01 +00:00
ttf.h Don't show unusable fonts in font selector. 2019-11-23 16:17:01 +00:00
ui.h + safe height gcode parameter 2021-10-23 20:01:29 -04:00
undoredo.cpp Convert many loops to range-for or std algorithms. NFC. 2019-08-20 15:57:11 +00:00
util.cpp Performance optimization of the Vector class 2020-10-23 20:08:43 -04:00
view.cpp move perspective, lighting, and explode distance from configuration screen to view screen. 2021-08-29 13:54:38 -04:00