Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
point not in contour.points list but it is in
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joancarles Casasín  
View profile  
 More options Jun 25 2012, 8:05 am
From: Joancarles Casasín <joa...@casasin.com>
Date: Mon, 25 Jun 2012 14:05:22 +0200
Local: Mon, Jun 25 2012 8:05 am
Subject: point not in contour.points list but it is in
Hi all,
Is there anything wrong here?
I'm still trying to delete points from a script and while digging found this happening:

################################

g = CurrentGlyph()

for con in g:
    for p in con.points:
        if p.selected:
            print p
            print con.points
            print con.points.index℗

<Point x:240 y:736>
[<Point x:370.0 y:493.245283127>, <Point x:453.0 y:595.245283127>, <Point x:240 y:736>, <Point x:27.0 y:595.245283127>, <Point x:110.0 y:493.0>, <Point x:240.0 y:592.0>]
Traceback (most recent call last):
  File "<untitled>", line 8, in <module>
ValueError: <Point x:240 y:736> is not in list

################################

Any idea?

Thanks as usual,

Joancarles

- - - - - - - - - - -
Joancarles Casasín
un senyor de lletres i de cičncies que passava per aquí
www.casasin.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frederik Berlaen  
View profile   Translate to Translated (View Original)
 More options Jun 25 2012, 8:22 am
From: Frederik Berlaen <frede...@typemytype.com>
Date: Mon, 25 Jun 2012 14:22:43 +0200
Local: Mon, Jun 25 2012 8:22 am
Subject: Re: [rf] point not in contour.points list but it is in
He Joancarles

I assume you are having this issue inside RoboFont

roboFab in RoboFont generate all objects on the fly / on request from the defcon data
so if you ask a contour for his points it will generate a list of Point objects, next them you request the same list, the point objects will be different objects (with the same reference defcon data)

why: a object wrapper can not contain any data

good luck!

"""
g = CurrentGlyph()

for con in g:
    # cache the list localy
    points = con.points
    # loop over the cached list
    for p in points:
        if p.selected:
            print p
            print points
            # ask the cached list for the index of the point object
            print points.index(p)
"""

gr Frederik
www.typemytype.com

On 25 Jun 2012, at 14:05, Joancarles Casasín wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joancarles Casasín  
View profile  
 More options Jun 25 2012, 9:05 am
From: Joancarles Casasín <joa...@casasin.com>
Date: Mon, 25 Jun 2012 15:05:51 +0200
Local: Mon, Jun 25 2012 9:05 am
Subject: Re: [rf] point not in contour.points list but it is in
Got it, thanks Frederik.

But as I understand, that means that I can pop or remove an element from the list but this doesn't affect the glyph.
I mean I'm removing the point from the list but not from the glyph itself.

All I want is to delete the currently selected points in a glyph.

Cheers,

jca

PD: The same happens within FontLab

El 25/06/2012, a les 14:22, Frederik Berlaen va escriure:

- - - - - - - - - - -
Joancarles Casasín
un senyor de lletres i de cičncies que passava per aquí
www.casasin.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tal Leming  
View profile  
 More options Jun 25 2012, 9:12 am
From: Tal Leming <t...@typesupply.com>
Date: Mon, 25 Jun 2012 09:12:16 -0400
Local: Mon, Jun 25 2012 9:12 am
Subject: Re: [rf] point not in contour.points list but it is in

On Jun 25, 2012, at 9:05 AM, Joancarles Casasín wrote:

> But as I understand, that means that I can pop or remove an element from the list but this doesn't affect the glyph.
> I mean I'm removing the point from the list but not from the glyph itself.

That's generally not advisable in RoboFab. The various lists that you are presented with are almost never tied to the raw objects that they wrap. (This is a long, complex story. Short version: many of the list-like objects that represent iterable data structures are illusions. Creating lists that respond to pop, del and so on was not something that we were able to achieve way back in the day.) The best way to remove things is with object.removeFoo(i) and so on.

Tal


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joancarles Casasín  
View profile  
 More options Jun 25 2012, 10:41 am
From: Joancarles Casasín <joa...@casasin.com>
Date: Mon, 25 Jun 2012 16:41:51 +0200
Local: Mon, Jun 25 2012 10:41 am
Subject: Re: [rf] point not in contour.points list but it is in

El 25/06/2012, a les 15:12, Tal Leming va escriure:

> On Jun 25, 2012, at 9:05 AM, Joancarles Casasín wrote:

>> But as I understand, that means that I can pop or remove an element from the list but this doesn't affect the glyph.
>> I mean I'm removing the point from the list but not from the glyph itself.

> That's generally not advisable in RoboFab. The various lists that you are presented with are almost never tied to the raw objects that they wrap. (This is a long, complex story. Short version: many of the list-like objects that represent iterable data structures are illusions. Creating lists that respond to pop, del and so on was not something that we were able to achieve way back in the day.) The best way to remove things is with object.removeFoo(i) and so on.

Sure, that was my first attempt.

contour.removeSegment(i) is my first choice.
Now trying to manage how to deal with it : )

Thanks!

jca

- - - - - - - - - - -
Joancarles Casasín
un senyor de lletres i de cičncies que passava per aquí
www.casasin.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Wenzel  
View profile  
 More options Aug 5 2012, 12:47 pm
From: Martin Wenzel <mar...@martinplus.com>
Date: Sun, 5 Aug 2012 18:47:30 +0200
Local: Sun, Aug 5 2012 12:47 pm
Subject: Re: [rf] point not in contour.points list but it is in
Hi everybody,

A few weeks ago the removing of contours/segments of a glyph had been talked about. I think I understood the explanation why it didn't work but not how to solve it.

# My script with which I'm trying to remove all contours/segments of certain glyphs
from robofab.world import AllFonts
fonts = AllFonts()
removeContent = ['Eth', 'i.dot']

for f in fonts:
        for g in removeContent:
                if f[g]:
                        glyph = f[g]
                        for contour in glyph:
                                for segment in contour:
                                        contour.removeSegment(segment.index)
        f.update()

# The error
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/Applications/robofab/RoboFab/Lib/robofab/objects/objectsFL.py", line 1854, in removeSegment
    segment = self.segments[index]
IndexError: list index out of range

I'd be grateful for any pointer that explains what I'm doing wrong?

Thanks,
Martin

On Jun 25, 2012, at 16:41 , Joancarles Casasín wrote:

- - -  Communication and Type Design:
- - -  http://www.MartinPlus.com
- - -  The Foundry with Typefaces by MartinPlus:
- - -  http://www.MartinPlusFonts.com
phone +49 (0)30 88 72 79 70
mobile +49 (0)15 20 35 45 006

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tal Leming  
View profile  
 More options Aug 5 2012, 1:33 pm
From: Tal Leming <t...@typesupply.com>
Date: Sun, 5 Aug 2012 13:33:11 -0400
Local: Sun, Aug 5 2012 1:33 pm
Subject: Re: [rf] point not in contour.points list but it is in
I think the problem is that you are trying to modify the contour while you are iterating over it. This is a safer way to do it:

...
for contour in glyph:
        toRemove = []
    for segment in contour:
                toRemove.append(segment.index)
    toRemove.reverse()
    for index in toRemove:
        contour.removeSegment(index)
...

There's still a likelihood that this will raise a traceback when it gets to the last segment of a contour. If you are trying to remove all content from a glyph, the clear method is the best way to go:

###
from robofab.world import AllFonts
fonts = AllFonts()
removeContent = ['Eth', 'i.dot']

for f in fonts:
        for g in removeContent:
                f[g].clear()
        f.update()
###

Tal

On Aug 5, 2012, at 12:47 PM, Martin Wenzel wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Wenzel  
View profile  
 More options Aug 5 2012, 1:36 pm
From: Martin Wenzel <mar...@martinplus.com>
Date: Sun, 5 Aug 2012 19:36:39 +0200
Local: Sun, Aug 5 2012 1:36 pm
Subject: Re: [rf] point not in contour.points list but it is in
Hi Tal,

excellent, thank you for your explanation. I'll have a go at it …

Martin

On Aug 5, 2012, at 19:33 , Tal Leming wrote:

- - -  Communication and Type Design:
- - -  http://www.MartinPlus.com
- - -  The Foundry with Typefaces by MartinPlus:
- - -  http://www.MartinPlusFonts.com
phone +49 (0)30 88 72 79 70
mobile +49 (0)15 20 35 45 006

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »