On Wed, May 16, 2012 at 08:25:02PM EDT, richard emberson wrote:
> Is there a way in Vim to tell if a character will actually be rendered
> for the end viewer? So, a script can know not to use that character.
> Or, must the end user of the script always have to figure out that
> they must set some configuration options to disable the use of such
> characters?
I would imagine that Vim (or other terminal applications do not care and
that it is just a matter of whether the font provides a glyph for the
required character.
As I understand it, fontconfig is able to figure out from imbedded
tables what character range(s) is(are) covered by a given font.
If you run an ‘fc-scan /usr/share/fonts/../myfont’ from a shell prompt,
you should see a ‘charset: property, which looks like what you are
looking for... presumably a table where bits are set when the code point
is covered by the font... - I'm mostly guessing since I haven't found
any documentatiion that gives much detail.
OTOH, libfontconfig does provides an ‘FcCharSetHasChar’ function that
suspiciously looks like it may do what you need.
If it does, you would still have to figure out how to invoke the
function from a VimL script.. I believe python, perl, ruby.. etc.
provide bindings to libfontconfig, but I not sure VimL even provides
a mechanism where you could write your own.
If there's any truth in the above guesswork.. and you manage to figure
out the layout of fc-scan's ‘charset:’ output you could always use
VimL's ‘system()’ function to read it into a variable and figure it out
yourself.. neither pretty nor robust in the long run (any one could
decide to ‘improve’ the outpout of fc-scan at a later date)
A quick search of the fontconfig mailing list did not reveal anything
conclusive, so I would suggest asking them for assistance.
CJ
--
Focus follow mouse users will burn in hell!!!