<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to customize preview of space center?]]></title><description><![CDATA[<p dir="auto">Hi, I have made this tool that generates contours for glyphs' "outer" countershapes. How does xHeight cut work currently in space center? Would it be possible to build a tool on top of it that doesn't display glyphs' "inner" counter shapes? I have problems to do the spacing right, and I think this tool helped me a bit to understand it. But each time I change the spacing I need to generate new layer with those contours. Thanks for advise!<br />
<img src="/assets/uploads/files/1589219264824-screenshot-2020-05-11-at-19.47.03.png" alt="Screenshot 2020-05-11 at 19.47.03.png" class="img-responsive img-markdown" /></p>
]]></description><link>https://forum.robofont.com/topic/861/how-to-customize-preview-of-space-center</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 14:03:16 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/861.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 May 2020 17:53:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to customize preview of space center? on Tue, 12 May 2020 10:56:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi, I have made this tool that generates contours for glyphs' "outer" countershapes. How does xHeight cut work currently in space center? Would it be possible to build a tool on top of it that doesn't display glyphs' "inner" counter shapes? I have problems to do the spacing right, and I think this tool helped me a bit to understand it. But each time I change the spacing I need to generate new layer with those contours. Thanks for advise!<br />
<img src="/assets/uploads/files/1589219264824-screenshot-2020-05-11-at-19.47.03.png" alt="Screenshot 2020-05-11 at 19.47.03.png" class="img-responsive img-markdown" /></p>
]]></description><link>https://forum.robofont.com/post/3302</link><guid isPermaLink="true">https://forum.robofont.com/post/3302</guid><dc:creator><![CDATA[jansindl3r]]></dc:creator><pubDate>Tue, 12 May 2020 10:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to How to customize preview of space center? on Tue, 12 May 2020 14:40:56 GMT]]></title><description><![CDATA[<p dir="auto">hello <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/454">@jansindl3r</a>,</p>
<p dir="auto">this looks like a very useful tool.</p>
<p dir="auto">here is an example which uses <a href="http://defcon.robotools.dev/en/latest/concepts/representations.html" rel="nofollow">representations</a> to create and cache shapes – this is recommended for performance.</p>
<pre><code class="language-python">from vanilla import FloatingWindow, CheckBox
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.events import addObserver, removeObserver
from mojo.UI import CurrentSpaceCenter
from defcon import Glyph, registerRepresentationFactory, unregisterRepresentationFactory
import mojo.drawingTools as ctx
from fontTools.pens.cocoaPen import CocoaPen
from random import random

def CounterShapeFactory(glyph):
    pen = CocoaPen(glyph.layer)
    # just a rect -- draw your counter shapes here
    pen.moveTo((0, 0))
    pen.lineTo((glyph.width, 0))    
    pen.lineTo((glyph.width, glyph.font.info.xHeight))
    pen.lineTo((0, glyph.font.info.xHeight))
    pen.closePath()
    return pen.path

class CounterShapeViewer(BaseWindowController):

    def __init__(self):
        self.w = FloatingWindow((123, 40))
        self.w.preview = CheckBox((10, 10, -10, 20), 'preview', value=True, callback=self.updatePreviewCallback)
        self.setUpBaseWindowBehavior()
        registerRepresentationFactory(Glyph, "CounterShapePreview", CounterShapeFactory)
        addObserver(self, "drawCounterShape", "spaceCenterDraw")
        self.w.open()

    def windowCloseCallback(self, sender):
        super().windowCloseCallback(sender)
        removeObserver(self, "spaceCenterDraw")
        unregisterRepresentationFactory(Glyph, "CounterShapePreview")

    def updatePreviewCallback(self, sender):
        S = CurrentSpaceCenter()
        if not S:
            return
        S.updateGlyphLineView()

    def drawCounterShape(self, notification):
        S = CurrentSpaceCenter()
        if not S or not self.w.preview.get():
            return
        glyph = notification['glyph']   
        counterShape = glyph.getRepresentation("CounterShapePreview")
        ctx.save()
        ctx.fill(random(), random(), random(), 0.3)
        ctx.drawPath(counterShape)
        ctx.restore()

CounterShapeViewer()
</code></pre>
<p dir="auto">give it a try… cheers!</p>
]]></description><link>https://forum.robofont.com/post/3303</link><guid isPermaLink="true">https://forum.robofont.com/post/3303</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Tue, 12 May 2020 14:40:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to customize preview of space center? on Tue, 12 May 2020 13:58:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/22">@gferreira</a> thanks a lot for you help, it works pretty smooth! But how do you remove the original contour that contains the whole shape? I can't figure it out :(</p>
]]></description><link>https://forum.robofont.com/post/3304</link><guid isPermaLink="true">https://forum.robofont.com/post/3304</guid><dc:creator><![CDATA[jansindl3r]]></dc:creator><pubDate>Tue, 12 May 2020 13:58:48 GMT</pubDate></item><item><title><![CDATA[Reply to How to customize preview of space center? on Thu, 21 May 2020 13:41:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.robofont.com/uid/454">@jansindl3r</a> I don’t know if it’s possible not to draw the glyph shape. but you can “erase” it by drawing the glyph on top of itself with the background color – see an example <a href="https://github.com/gferreira/groupSpacing/blob/9b5f6361d8ce85351db720215e63b87365f7c4e6/groupSpacing.roboFontExt/lib/groupSpacing.py#L419" rel="nofollow">here</a>.</p>
]]></description><link>https://forum.robofont.com/post/3305</link><guid isPermaLink="true">https://forum.robofont.com/post/3305</guid><dc:creator><![CDATA[gferreira]]></dc:creator><pubDate>Thu, 21 May 2020 13:41:23 GMT</pubDate></item><item><title><![CDATA[Reply to How to customize preview of space center? on Wed, 13 May 2020 09:07:15 GMT]]></title><description><![CDATA[<p dir="auto">euh, something simple:</p>
<pre><code># draw the background color of the existing glyph

from mojo.UI import getDefault

r, g, b, a = getDefault("spaceCenterBackgroundColor")

bounds = glyph.bound
if bounds:
    x, y, maxx, maxy = bounds
    w = maxx - x
    h = maxy - y
    ctx.fill(r, g, b, a)
    offset = 10
    ctx.rect(x-offset, y-offset, w+offset*2, h+offset*2)
</code></pre>
]]></description><link>https://forum.robofont.com/post/3308</link><guid isPermaLink="true">https://forum.robofont.com/post/3308</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 13 May 2020 09:07:15 GMT</pubDate></item><item><title><![CDATA[Reply to How to customize preview of space center? on Wed, 13 May 2020 09:16:48 GMT]]></title><description><![CDATA[<p dir="auto">or wrap changing fill and stroke inside <code>spaceCenterDrawBackgroundLineView</code> <code>spaceCenterDrawLineView</code> notifications.</p>
<p dir="auto">A multiline view has a <code>_fill</code> and <code>_stroke</code> attribute you can temporarily overwrite.</p>
<p dir="auto">good luck</p>
]]></description><link>https://forum.robofont.com/post/3309</link><guid isPermaLink="true">https://forum.robofont.com/post/3309</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 13 May 2020 09:16:48 GMT</pubDate></item></channel></rss>