Adding bold text decoration to a theme

268 views
Skip to first unread message

probonogeek

unread,
May 2, 2011, 1:50:03 AM5/2/11
to Ajax.org Cloud9 Editor (Ace)
In an effort to make a theme a bit more consistent with an editor I
use on my desktop, I modified a theme to use "font-weight: bold" for
"keyword" tokens. This worked great on my linux box and for several
windows users. However, I started getting reports from Mac users that
the cursor positioning was being incorrectly calculated, and the
amount that the cursor is off seems to be related to how many
characters are rendered in bold.

I was wondering if anyone has any thoughts on where I might start to
look to fix this problem? Best as I can tell this is an issue with the
Monaco font used by default and available on all Macs, but *not*
available in the default font sets of a Linux or Windows desktop. My
guess then is that the width of Monaco fonts changes when bolded,
which throws off the cursor calculation. Is there some place in the
code we might be able to compensate for this?

I'm slowing working through the internals of Ace, so with luck I may
stumble upon what I'm looking for accidentally, but I figure it's
faster to just ask and maybe get lucky.

-Sean

Fabian Jakobs

unread,
May 18, 2011, 1:46:53 PM5/18/11
to ace-d...@googlegroups.com
Hie Sean,

I assume that all characters have the same width. For that reason text
cannot be bold, italic of have a non monospace font face. Adding
support for variable character widths is not planned at the moment and
would require a major refactor.

Best,
Fabian

> --
> You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
> To post to this group, send email to ace-d...@googlegroups.com.
> To unsubscribe from this group, send email to ace-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ace-discuss?hl=en.
>
>

Sean Kellogg

unread,
May 18, 2011, 2:13:48 PM5/18/11
to ace-d...@googlegroups.com
Thanks Fabian, my initial investigation suggested this was the case. What's frustrating is the problem is entirely with the default font used by Ace. At least on linux and windows, "Courier New" is monospaced for bold and italic and the width as its undecorated counterparts... it's only Monaco (and Menlo, I presume... I don't have access to that font) which have the differing widths.

At this point I'm tempted to just default the editor to Courier New for my application so I can have more expressive syntax rules... bolding is awfully handy to have.

-Sean

--
Sean Kellogg
e: skel...@probonogeek.org

Reply all
Reply to author
Forward
0 new messages