Skip to content

stb_truetype: stbtt__fill_active_edges_new() dy=nan #1721

@MWP

Description

@MWP

I won't pretend to know what's going on in this function, but it's creating an ARM FPU fault.

I can trace through the code, and have found the following results in a div by 0.

               // check if final y_crossing is blown up; no test case for this
               if (y_final > y_bottom) {
                  y_final = y_bottom;
                  dy = (y_final - y_crossing ) / (x2 - (x1+1)); // if denom=0, y_final = y_crossing, so y_final <= y_bottom
               }

In this case, y_final=-14 y_crossing=-14 x2=21 and x1=20.

The ARM FPU fault then occurs on:

               step = sign * dy * 1; // dy is dy/dx, change in y for every 1 change in x,

If it matters, the font is: https://www.fontrepo.com/font/4274/painting-with-chocolate

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions