Re: Merge point function crashes
Skef Iterum <[email protected]> Tue, 5 Mar 2019 08:14:46 -0800
| Newsgroups | gmane.comp.fonts.fontforge.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============8280974409534323724==
Content-Type: multipart/alternative;
boundary="------------71D3974152C8B526D2E4F78F"
Content-Language: en-US
This is a multi-part message in MIME format.
--------------71D3974152C8B526D2E4F78F
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
If you file an issue on github with easy steps to reproduce I'm likely
to look at it. I've been in the python code recently.
Skef
On 3/5/19 8:06 AM, Abraham Lee wrote:
> Devs,
>
> I'm discovering more and more all the time how powerful the python
> interface is. So, to anyone and everyone developing it, thank you!
> I've been able to do some wonderful things with it both in standalone
> scripts and in plugins while working in the GUI.
>
> The other day I ran into a crash while attempting to merge an on-curve
> point. Let's say I create a contour in the following way:
>
> import fontforge, psMat
> cntr = fontforge.contour()
> cntr.moveTo(0, 100)
> cntr.lineTo(100, 100)
> cntr.cubicTo(120, 100, 140, 80, 140, 60)
> cntr.cubicTo(140, 30,100, 0, 0, 0)
> print cntr
>
> ... which shows this:
> <Contour(cubic)
> (0,100) on
> (100,100) on
> (120,100) off
> (140,80) off
> (140,60) on
> (140,30) off
> (100,0) off
> (0,0) on
> >
>
> There are several on-curve points with this simple contour. Now, let's
> say the contour is transformed (e.g. skewed) and the points that were
> previously extrema are no longer:
>
> ang = 8 # degrees, clockwise
> angrad = ang*3.14159/180
> cntr.transform(psMat.skew(angrad))
> print cntr
>
> ... which shows this now:
> <Contour(cubic)
> (14.0537,100) on
> (114.054,100) on
> (134.054,100) off
> (151.243,80) off
> (148.433,60) on
> (144.216,30) off
> (100,0) off
> (0,0) on
> >
>
> There are no extrema points on the curves anymore. Now, let's add
> extrema back onto the contour:
>
> cntr.addExtrema('all')
> print cntr
>
> ... which now shows:
> <Contour(cubic)
> (14.0537,100) on
> (114.054,100) on
> (132.603,100) off
> (148.735,82.7958) off
> (148.735,64.3438) on
> (148.735,62.901) off
> (148.636,61.4505) off
> (148.433,60) on
> (144.216,30) off
> (100,0) off
> (0,0) on
> >
>
> The on-curve point at (148.735,64.3438) is now the new extrema. I no
> longer want the non-extrema on-curve point at (148.433, 60) anymore,
> so we attempt to merge it:
>
> pos = 7 # this is the 0-based position
> cntr.merge(pos)
>
> ... and then the crash happens. I haven't been able to narrow down, at
> least on my input-side, what could be causing the full program crash.
> I usually can find that I've done something non-obviously wrong with
> my code, but this has me stumped.
>
> There's that problem, and then there's a follow on one. As described
> in the docs, "merge" should be able to accept a single integer or a
> list of integers. Looking at the source code for the function suggests
> similarly. However, when a list (or an array of any kind, like tuple)
> is supplied, the function throws an error saying that it accepts only
> a single integer.
>
> I searched the repo at the current master branch and also at the
> snapshot commit of the current release of FF, but the code seems to be
> the same that drives the merge function. So, I'm not sure how to
> proceed. I can try to code up my own merge function, but I'd rather
> not if I can avoid it ;-)
>
> Any thoughts?
>
> Best,
> Abraham
>
>
> _______________________________________________
> fontforge-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fontforge-devel
> http://fontforge.10959.n7.nabble.com/Developer-f3.html
--------------71D3974152C8B526D2E4F78F
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>If you file an issue on github with easy steps to reproduce I'm
likely to look at it. I've been in the python code recently. <br>
</p>
<p>Skef<br>
</p>
<div class="moz-cite-prefix">On 3/5/19 8:06 AM, Abraham Lee wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAHAQwh1nxfatQffc8GKqRSDPcX0b6ATnKdYtJmtda=dWdUo6WQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Devs,
<div><br>
</div>
<div>I'm discovering more and more all the time how
powerful the python interface is. So, to anyone
and everyone developing it, thank you! I've been
able to do some wonderful things with it both in
standalone scripts and in plugins while working in
the GUI.</div>
<div><br>
</div>
<div>The other day I ran into a crash while
attempting to merge an on-curve point. Let's say I
create a contour in the following way:</div>
<div><br>
</div>
<div>import fontforge, psMat</div>
<div>cntr = fontforge.contour()</div>
<div>cntr.moveTo(0, 100)</div>
<div>cntr.lineTo(100, 100)</div>
<div>cntr.cubicTo(120, 100, 140, 80, 140, 60)</div>
<div>cntr.cubicTo(140, 30,100, 0, 0, 0)</div>
<div>print cntr</div>
<div><br>
</div>
<div>... which shows this:</div>
<div><Contour(cubic)</div>
<div> (0,100) on</div>
<div> (100,100) on</div>
<div> (120,100) off</div>
<div> (140,80) off</div>
<div> (140,60) on</div>
<div> (140,30) off</div>
<div> (100,0) off</div>
<div> (0,0) on</div>
<div>></div>
<div><br>
</div>
<div>There are several on-curve points with this
simple contour. Now, let's say the contour is
transformed (e.g. skewed) and the points that were
previously extrema are no longer:</div>
<div><br>
</div>
<div>ang = 8 # degrees, clockwise</div>
<div>angrad = ang*3.14159/180</div>
<div>cntr.transform(psMat.skew(angrad))</div>
<div>print cntr</div>
<div><br>
</div>
<div>... which shows this now:</div>
<div>
<div><Contour(cubic)</div>
<div> (14.0537,100) on</div>
<div> (114.054,100) on</div>
<div> (134.054,100) off</div>
<div> (151.243,80) off</div>
<div> (148.433,60) on</div>
<div> (144.216,30) off</div>
<div> (100,0) off</div>
<div> (0,0) on</div>
<div>></div>
</div>
<div><br>
</div>
<div>There are no extrema points on the curves
anymore. Now, let's add extrema back onto the
contour:</div>
<div><br>
</div>
<div>cntr.addExtrema('all')</div>
<div>print cntr</div>
<div><br>
</div>
<div>... which now shows:</div>
<div>
<div><Contour(cubic)</div>
<div> (14.0537,100) on</div>
<div> (114.054,100) on</div>
<div> (132.603,100) off</div>
<div> (148.735,82.7958) off</div>
<div> (148.735,64.3438) on</div>
<div> (148.735,62.901) off</div>
<div> (148.636,61.4505) off</div>
<div> (148.433,60) on</div>
<div> (144.216,30) off</div>
<div> (100,0) off</div>
<div> (0,0) on</div>
<div>></div>
</div>
<div><br>
</div>
<div>The on-curve point at (148.735,64.3438) is now
the new extrema. I no longer want the non-extrema
on-curve point at (148.433, 60) anymore, so we
attempt to merge it:</div>
<div><br>
</div>
<div>pos = 7 # this is the 0-based position</div>
<div>cntr.merge(pos)</div>
<div><br>
</div>
<div>... and then the crash happens. I haven't been
able to narrow down, at least on my input-side,
what could be causing the full program crash. I
usually can find that I've done something
non-obviously wrong with my code, but this has me
stumped. </div>
<div><br>
</div>
<div>There's that problem, and then there's a follow
on one. As described in the docs, "merge" should
be able to accept a single integer or a list of
integers. Looking at the source code for the
function suggests similarly. However, when a list
(or an array of any kind, like tuple) is supplied,
the function throws an error saying that it
accepts only a single integer.</div>
<div><br>
</div>
<div>I searched the repo at the current master
branch and also at the snapshot commit of the
current release of FF, but the code seems to be
the same that drives the merge function. So, I'm
not sure how to proceed. I can try to code up my
own merge function, but I'd rather not if I can
avoid it ;-)<br>
</div>
<div><br>
</div>
<div>Any thoughts?</div>
<div><br>
</div>
<div>Best,</div>
<div>Abraham</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fontforge-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/fontforge-devel">https://lists.sourceforge.net/lists/listinfo/fontforge-devel</a>
<a class="moz-txt-link-freetext" href="http://fontforge.10959.n7.nabble.com/Developer-f3.html">http://fontforge.10959.n7.nabble.com/Developer-f3.html</a>
</pre>
</blockquote>
</body>
</html>
--------------71D3974152C8B526D2E4F78F--
--===============8280974409534323724==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============8280974409534323724==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html
--===============8280974409534323724==--