222 lines
6.8 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RoboFab Objects: RContour</title>
<link href="../default.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="modellogo">
<img src="../img/drawmodel_header.jpg" width="595" height="112" />
</div>
<div class="leftcontent">
<h2 class="crb-seealso">
RoboFab
</h2>
<p class="menu">
<a href="../index.html">
Home
</a>
<br />
<a href="../download/license.html">
Download v1.1.1
</a>
<br />
<a href="../intro.html">
Intro
</a>
<br />
<a href="../install.html">
Install Notes
</a>
<br />
<a href="../history.html">
History
</a>
<br />
<a href="../executive.html">
Summary
</a>
</p>
<p class="menu">
<a href="../howto/index.html">
How to's
</a>
<br />
<a href="index.html">
Fab Objects
</a>
<br />
<a href="model.html">
Fab Map
</a>
<br />
<a href="../tools/index.html">
Fab Tools
</a>
<br />
<a href="../ufo/index.html">
UFO Overview
</a>
<br />
<a href="../limitations.html">
Fab Limitations
</a>
</p>
<p class="menu">
<a href="../links/index.html">
Links
</a>
<br />
<a href="../glossary/index.html">
Glossary
</a>
<br />
<a href="../credits.html">
Credits
</a>
</p>
<br />
<br />
<p class="crb-uplink"><a href="index.html">Back to Objects</a></p>
<br />
<br />
<p class="menu">
<a href="../howto/buildingaccents.html">Building accents</a><br />
<a href="../howto/glyphmath.html">Using Glyph Math</a><br />
<a href="../howto/understandcontours.html">Understanding Contours</a><br />
<a href="../howto/usetransformations.html">Using transformations</a><br />
<a href="anchor.html">RAnchor</a><br />
<a href="bpoint.html">bPoint</a><br />
<a href="component.html">RComponent</a><br />
<a href="font.html">RFont</a><br />
<a href="glyph.html">RGlyph</a><br />
<a href="index.html">Objects</a><br />
<a href="info.html">RInfo</a><br />
<a href="kerning.html">RKerning</a><br />
<a href="lib.html">RLib</a><br />
<a href="model.html">Object model</a><br />
<a href="pen.html">Pen objects</a><br />
<a href="point.html">RPoint</a><br />
<a href="segment.html">RSegment</a><br />
</p>
</div>
<div class="footer">
<a href="../feedback.html">
Feedback
</a>
<br />
<a href="../map.html">
Sitemap
</a>
<br />
Please also refer to the
<a href="../download/license.html">
Legal
</a>
<br />
Copyright 2003-2005 RoboFab
<br />
version 1.1.1
</div>
<div id="titlepic">
<img src="../img/offdrawmodel_30.gif" alt="" border="0" />
</div>
<div class="content">
<h1>RoboFab RContour</h1>
<h3>Usage</h3>
<pre># take a glyph (one with outlines obviously)
c = CurrentGlyph()
# get to contours by index:
print c[0]
>>> < RContour for Mailer-Regular.a[0] >
</pre>
<h3>Description</h3>
<p>
RContour is an object for, well, contours. A contour is a single path of any number of points and shape. A glyph usually consists of a couple fo contours, and this the object that represents each one. The RContour object offers access to the outline matter in various ways. The parent of RContour is usually RGlyph.
</p>
<h3>Understanding Contours and outlines</h3>
<p>
The way outline data is organised in RoboFab, and how the various objects relate is described here: <a href="../howto/understandcontours.html">understanding contours</a>.
<p class="note">If you want to add new contours to a glyph it's easier to <a href="../howto/usepens.html">draw them with a pen</a> than to construct the shapes from segments.</p>
</p>
<h3>Attributes</h3>
<ul>
<li><strong>index</strong>: the index of the contour in the Glyph.</li>
<li><strong>selected</strong>: returns 1 if the contour is selected, 0 if it isn't.</li>
<li><strong>box</strong>: the bounding box for the contour (read only).</li>
<li><strong>clockwise</strong>: direction of contour: 1=clockwise 0=counterclockwise</li>
<li><strong>points</strong>: the contour as a list of <a href="points.py">Points</a>.</li>
<li><strong>bPoints</strong>: the contour as a list of <a href="bpoints.py">bPoints</a>.</li>
</ul>
<h3>Attribute examples</h3>
<p>
<a href="../howto/understandcontours.html">Examples with contours and points here.</a>
</p>
<h3>Methods for segments</h3>
<p>For regular drawing in glyphs: please use <a href="../howto/usepens.html">Pens</a>. If you want to mess with segments on a lower level, be our guest:
</p>
<ul>
<li><strong>appendSegment(segmentType, points, smooth=False)</strong>: add a segment to the contour. Parameters?</li>
<li><strong>insertSegment(index, segmentType, points, smooth=False)</strong>: insert a segment into the contour. </li>
<li><strong>removeSegment(index)</strong>: remove a segment from the contour.</li>
<li><strong>setStartSegment(segmentIndex)</strong>: set the first node on the contour.</li>
</ul>
<h3>Methods for points</h3>
<p>
</p>
<ul>
<li><strong>appendBPoint(pointType, anchor, bcpIn=(0, 0), bcpOut=(0, 0))</strong>: append a bPoint to the contour.</li>
<li><strong>autoStartSegment()</strong>: automatically set the lower left point of the contour as the first point.</li>
<li><strong>insertBPoint(index, pointType, anchor, bcpIn=(0, 0), bcpOut=(0, 0))</strong>: insert a bPoint at index on the contour.</li>
</ul>
<h3>Other methods</h3>
<p>
</p>
<ul>
<li><strong>reverseContour()</strong>: reverse contour direction.</li>
<li><strong>copy()</strong>: duplicate this contour.</li>
<li><strong>draw(aPen)</strong>: draw the object with a RoboFab segment pen.</li>
<li><strong>drawPoints(aPen)</strong>: draw the object with a point pen.</li>
<li><strong>move((x, y))</strong>: move the contour.</li>
<li><strong>pointInside((x, y), evenOdd=0)</strong>: determine if the point is inside or ouside of the contour.</li>
<li><strong>round()</strong>: round the value of all points in the contour.</li>
<li>
<strong>scale((x, y), center=(0, 0))</strong>: Scale the contour by x and y. Optionally set the center of the scale.
</li>
<li>
<strong>rotate(angle, offset=None)</strong>: Rotate the contour by angle (in degrees). Optionally set an offset value.
</li>
<li>
<strong>skew(angle, offset=None)</strong>: Skew the contour by angle (in degrees). Optionally set an offset value.
</li>
<li><strong>transform(matrix)</strong>: transform this contour.
Use a Transform matrix object to mess with the contour. See also <a href="../howto/usetransformations.html">how to use transformations.</a></li>
</ul>
<h3>Method examples</h3>
<pre>#method examples
</pre>
</div>
</body>
</html>