Permalink
Browse files

Explain the data structure produced when reading a glyph

  • Loading branch information...
codingisacopingstrategy committed Apr 27, 2013
1 parent a8cd766 commit af1687c28dc9c0f1a91cad660b06ecec05a9bd93
Showing with 187 additions and 1 deletion.
  1. +187 −1 lib/UFO/glyphFactories.js
@@ -5,7 +5,193 @@
* If not, see http://www.opensource.org/licenses/mit-license.php
*
* These methods currently return only the contour data from glif files.
*/
*
* This:
<?xml version="1.0" encoding="UTF-8"?>
<glyph name="A" format="1">
<advance width="487"/>
<unicode hex="0041"/>
<outline>
<contour>
<point x="243" y="681" type="move" name="top"/>
</contour>
<contour>
<point x="243" y="739" type="move" name="top"/>
</contour>
<contour>
<point x="243" y="-75" type="move" name="bottom"/>
</contour>
<contour>
<point x="243" y="739" type="move" name="top"/>
</contour>
<contour>
<point x="243" y="-75" type="move" name="bottom"/>
</contour>
<contour>
<point x="460" y="0" type="line"/>
<point x="318" y="664" type="line"/>
<point x="169" y="664" type="line"/>
<point x="27" y="0" type="line"/>
<point x="129" y="0" type="line"/>
<point x="150" y="94" type="line"/>
<point x="328" y="94" type="line"/>
<point x="348" y="0" type="line"/>
</contour>
<contour>
<point x="307" y="189" type="line"/>
<point x="172" y="189" type="line"/>
<point x="214" y="398" type="line"/>
<point x="239" y="541" type="line"/>
<point x="249" y="541" type="line"/>
<point x="264" y="399" type="line"/>
</contour>
</outline>
</glyph>
*
* Becomes:
*
{
"outline": [
[
"contour",
[
{
"x": "243",
"y": "681",
"type": "move",
"name": "top"
}
]
],
[
"contour",
[
{
"x": "243",
"y": "739",
"type": "move",
"name": "top"
}
]
],
[
"contour",
[
{
"x": "243",
"y": "-75",
"type": "move",
"name": "bottom"
}
]
],
[
"contour",
[
{
"x": "243",
"y": "739",
"type": "move",
"name": "top"
}
]
],
[
"contour",
[
{
"x": "243",
"y": "-75",
"type": "move",
"name": "bottom"
}
]
],
[
"contour",
[
{
"x": "460",
"y": "0",
"type": "line"
},
{
"x": "318",
"y": "664",
"type": "line"
},
{
"x": "169",
"y": "664",
"type": "line"
},
{
"x": "27",
"y": "0",
"type": "line"
},
{
"x": "129",
"y": "0",
"type": "line"
},
{
"x": "150",
"y": "94",
"type": "line"
},
{
"x": "328",
"y": "94",
"type": "line"
},
{
"x": "348",
"y": "0",
"type": "line"
}
]
],
[
"contour",
[
{
"x": "307",
"y": "189",
"type": "line"
},
{
"x": "172",
"y": "189",
"type": "line"
},
{
"x": "214",
"y": "398",
"type": "line"
},
{
"x": "239",
"y": "541",
"type": "line"
},
{
"x": "249",
"y": "541",
"type": "line"
},
{
"x": "264",
"y": "399",
"type": "line"
}
]
]
]
}
*/

define(['./dom', './glyph'], function(dom, glyph) {
/*definition*/

0 comments on commit af1687c

Please sign in to comment.