I'm try to convert a glyph into a format I can easily numerically
manipulate. So far I've figured out how to use ttfquery to get a list
that represents the outline of a contour in a glyph:
from ttfquery import describe, glyphquery, glyph
f = describe.openFo nt("/usr/share/fonts/truetype/freefont/
FreeSans.ttf")
n = glyphquery.glyp hName(f, 'D')
g = glyph.Glyph(n)
c = g.calculateCont ours(f)
o = glyph.decompose Outline(c[1])
o looks like:
[array([182, 82],'s'),
(354, 82),
(420.2222222222 2229, 90.000000000000 014),
(474.8888888888 8891, 114.0), ...,
array([182, 82],'s'),
array([182, 82],'s')]
Is this a polyline?
Thanks,
Alex 2 2711
swiftset wrote:
I'm try to convert a glyph into a format I can easily numerically
manipulate. So far I've figured out how to use ttfquery to get a list
that represents the outline of a contour in a glyph:
from ttfquery import describe, glyphquery, glyph
f = describe.openFo nt("/usr/share/fonts/truetype/freefont/
FreeSans.ttf")
n = glyphquery.glyp hName(f, 'D')
g = glyph.Glyph(n)
c = g.calculateCont ours(f)
o = glyph.decompose Outline(c[1])
o looks like:
[array([182, 82],'s'),
(354, 82),
(420.2222222222 2229, 90.000000000000 014),
(474.8888888888 8891, 114.0), ...,
array([182, 82],'s'),
array([182, 82],'s')]
Is this a polyline?
decomposeOutlin e docstring confirms -- it's a polyline. I think
elements marked with 's' starts new subpath.
w.
Wojciech Muła wrote:
swiftset wrote:
>I'm try to convert a glyph into a format I can easily numerically manipulate. So far I've figured out how to use ttfquery to get a list that represents the outline of a contour in a glyph:
from ttfquery import describe, glyphquery, glyph f = describe.openFo nt("/usr/share/fonts/truetype/freefont/ FreeSans.ttf ") n = glyphquery.glyp hName(f, 'D') g = glyph.Glyph(n) c = g.calculateCont ours(f) o = glyph.decompose Outline(c[1])
o looks like:
[array([182, 82],'s'), (354, 82), (420.222222222 22229, 90.000000000000 014), (474.888888888 88891, 114.0), ..., array([182, 82],'s'), array([182, 82],'s')]
Is this a polyline?
decomposeOutlin e docstring confirms -- it's a polyline. I think
elements marked with 's' starts new subpath.
w.
Examples of rendering self.contours and self.outlines (created by
self.compile on the Glyph) using OpenGL operations are in the toolsfont
module in OpenGLContext: http://pyopengl.cvs.sourceforge.net/...py?view=markup
The outlines are simple 2D line-loops, the things with 's' are array
objects (not start coordinates), you can convert the whole thing to a
consistent array with numpy.array (or Numeric.array). That is, the 's'
is just an artefact of how the calculation was done, the values are all
2-element coordinates, some as Python tuples, some as 2-element
Numeric/numpy "short" arrays.
HTH,
Mike
--
_______________ _______________ _______________ ___
Mike C. Fletcher
Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: r6uji7 |
last post by:
hello,
i am new to PHP programming and wondered if u could help.
lets say i have the following files:
1. error.php: that is routed to for all errors. this page should
display proper and explanatory error messages to the user based on the
parameter provided.
2. errordef.php: has all the error codes and their explanations
|
by: David Winter |
last post by:
I am looking for something I have seen a few months ago. Maybe someone
here remembers where this site is or has built something similar ... I
couldn't find it.
What I am looking for is a web page that presents its content as an
outliner. Ie, the page is divided into sections with headlines. On
load, only those headlines are visible. Beside each headline is an
arrow pointing to the right.
Hovering the mouse over a headline will bring...
|
by: Charlie |
last post by:
Hi, I'm looking for a way to obtain the width of a string, either in actual
inches/centimeters, or pixels will also work. Unfortunately this seems
difficult as I'd like to keep things as close to the stock Python install as
possible, and I'm not working with Graphics or X at all. Here are the options
I've found, and why they're less than optimal for my use:
PIL = Huge for only using one function. I'm not working with any graphics....
|
by: Chris Saunders |
last post by:
I am attempting to write and interface from another language to
some C code. I am having some difficulty interpreting a declaration.
int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
Any help would be appreciated.
Regards
Chris Saunders
chris.saunders@sympatico.ca
|
by: Chris Saunders |
last post by:
Hope this question is appropriate here.
I'm writing an interface to some C code for the language Eiffel.
I have come across this macro and am having difficuly interpreting
what it returns:
#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED, 0,0,0}
Could someone help?
Regards
| |
by: Julia |
last post by:
Hi,
Is it possible to set a different image for the sort Glyph in DataGridView?
Thanks in advance.
|
by: Chris Hayes |
last post by:
Greetings,
I have an ASP.NET page that accepts input from an HtmlInputFile object.
I have set the maximum size for HttpRequests to 2MB in the web.config file.
And now I am trying to CATCH the "Maximum request length exceeded"
HttpException when a user tries to send a file that is greater than 2MB so
that I may tell the user, gracefully, that their file is too big.
|
by: Manmeet Mittal |
last post by:
> Hi all this is Manmeet Mittal,
|
by: Greg Wright |
last post by:
I had the same problem and found that if I set Virtual = false, then the glyph went away after doing the EndEdit() function. I didn't have to do an EndEdit at all after that to get the Pencil gliph to disappear. Hope that helps.
Greg
SnapJag.com
gleew.wordpress.com
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |