On Wed, 23 Apr 2008 05:40:32 -0700 (PDT), Reckoner dixit:
> is it possible to have more than one font or font-size displayed
> simultaneously for the same file view? In other words, some words
> would be rendered in a different or bigger font than others in the
> same view.
First of all, a disclaimer: I haven't tried this thoroughly, so please
take my comment with a huge grain of salt ;))
This said, using the "highlight" command you are supposed to be able to
specify a font, like this:
highlight Whatever font=<font-name>
This only works for the GUI versions of Vim, and I haven't been able to
make it work at least on X Window System. At first I tried using font
names as used by GTK (well, fontconfig really, the same syntax I use for
"guifont") but it didn't work (I mean: the font didn't change). Later I
tried a couple of X Window System font names, and that didn't work
either, maybe I used a bad font name or something. I even tried using
nonsensical font names on purpose, and "highlight" accepted them without
problem (but the font was not changed, either).
The thing is that I didn't try further, so what I'm going to say may be
utterly wrong, but I think you won't be able to use a "tag-cloud-like"
look within GVim because being a text editor, it is cell-based so all
fonts should have, at least, the same point size to avoid redrawing
problems.
Using arbitrary, intermixed, point sizes would require Vim to perform
some additional computations to calculate where the heck the next line
should be drawn. I don't think GVim does that at the moment, instead
it's very possible that the position of the next line is calculated
using only the data coming from the font set with "guifont" (ascent,
descent, point size, maybe a small fixed additional gap between lines,
etc.).
Raúl "DervishD" Núñez de Arenas Coronado
--
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!
We are waiting for 13 Feb 2009 23:31:30 +0000 ...
Actually, this (varying the font by means of the ":highlight" command)
doesn't work in practice: gvim needs one single font for the whole text.
The "character cell" has a fixed size (fixed width and fixed height)
derived from the font's properties. Even the GTK2 version of gvim, which
can display "proportional" fonts, will display them in a fixed-size
character cell, clipping the wider characters and space-filling the
narrower ones, which makes the result ugly. The only exception to this
"fixed cell" rule is for East-Asian text, where "wide" characters
(ideograms etc.) occupy two cells each while "narrow" characters (Latin
letters etc.) occupy one cell each.
Only menus, tooltips, and similar "GUI widgets" may perhaps use a
different font than the rest. It is true that the 'guifont' option can
be a comma-separated list, but that possibility is rarely used since the
first installed font in the list is used and the rest are ignored.
As ThoML said, within the whole of the split-windows in a single
instance of Vim, you cannot make several font sizes coexist; what you
can use are background and foreground colours (in symbolic or #RRGGBB
form in gvim, i.e., 16777216 background colours and the same number of
foreground colours -- if your eye can tell them apart), plus any
combination of bold, underline and italic for a mind-boggling total of
(in theory) 16777216² times 8 (or 2^51) "text styles".
Best regards,
Tony.
--
"The bland leadeth the bland and they both shall fall into the kitsch."
On Wed, 23 Apr 2008 06:57:45 -0700 (PDT), Reckoner dixit:
> It works! your suggestion works great in vim7 on winXP. It's just a
> matter of choosing the highlight groups as in
>
> highlight Comment font=Courier_New:h12
>
> for example.
>
> thanks again.
It's surprising that it works! As I told you, I couldn't make it work!
I'm glad it works for you :)
> Is there nothing VIM can't do?
It makes a really horrible coffee. Patches are welcome XDDD
On Wed, 23 Apr 2008 15:57:17 +0200, Tony Mechelynck dixit:
> On 23/04/08 15:14, Raúl Núñez de Arenas Coronado wrote:
> > On Wed, 23 Apr 2008 05:40:32 -0700 (PDT), Reckoner dixit:
> >> is it possible to have more than one font or font-size displayed
> >> simultaneously for the same file view? In other words, some words
> >> would be rendered in a different or bigger font than others in the
> >> same view.
> >
> > First of all, a disclaimer: I haven't tried this thoroughly, so
> > please take my comment with a huge grain of salt ;))
> >
> > This said, using the "highlight" command you are supposed to be
> > able to specify a font, like this:
> >
> > highlight Whatever font=<font-name>
> >
> > This only works for the GUI versions of Vim, and I haven't been
> > able to make it work at least on X Window System. At first I tried
> > using font names as used by GTK (well, fontconfig really, the same
> > syntax I use for "guifont") but it didn't work (I mean: the font
> > didn't change). Later I tried a couple of X Window System font
> > names, and that didn't work either, maybe I used a bad font name or
> > something. I even tried using nonsensical font names on purpose,
> > and "highlight" accepted them without problem (but the font was not
> > changed, either).
>
> Actually, this (varying the font by means of the ":highlight"
> command) doesn't work in practice: gvim needs one single font for the
> whole text. The "character cell" has a fixed size (fixed width and
> fixed height) derived from the font's properties. Even the GTK2
> version of gvim, which can display "proportional" fonts, will display
> them in a fixed-size character cell, clipping the wider characters
> and space-filling the narrower ones, which makes the result ugly. The
> only exception to this "fixed cell" rule is for East-Asian text,
> where "wide" characters (ideograms etc.) occupy two cells each while
> "narrow" characters (Latin letters etc.) occupy one cell each.
I'm aware of the above, but even taking all this into account, if you
use the same point size for the font in
highlight Whatever font=<font>
then you should be able to see different fonts (note: not different
sizes).
The problem is that I haven't been able to make "font" work, no matter
the font size. I would be very happy if I am able to use different fonts
even with the size limitation (that's not a problem, really), just for
the sake of it ;)
I've tried with many combinations, but without any success...
Raúl "DervishD" Núñez de Arenas Coronado
I'm surprised. I've never seen it work (though I haven't actually
tried). Anyway, with more than 2,250,000,000,000,000 combinations (in
gvim) I'm not lacking possibilities ;-)
>
> then you should be able to see different fonts (note: not different
> sizes).
>
> The problem is that I haven't been able to make "font" work, no matter
> the font size. I would be very happy if I am able to use different fonts
> even with the size limitation (that's not a problem, really), just for
> the sake of it ;)
>
> I've tried with many combinations, but without any success...
>
> Raúl "DervishD" Núñez de Arenas Coronado
As I said, I haven't actually tried it. Which GUI are you using? Maybe
only GTK2 (or something) can do it? Remember that you give the point
size but it's the pixel size which much be the same, in all four of
height, width, ascent and descent.
Best regards,
Tony.
--
I have discovered the art of deceiving diplomats. I tell them the truth
and they never believe me.
-- Camillo Di Cavour
On Wed, 23 Apr 2008 17:14:25 +0200, Tony Mechelynck dixit:
> > I'm aware of the above, but even taking all this into account, if
> > you use the same point size for the font in
> >
> > highlight Whatever font=<font>
>
> I'm surprised. I've never seen it work (though I haven't actually
> tried). Anyway, with more than 2,250,000,000,000,000 combinations (in
> gvim) I'm not lacking possibilities ;-)
Looks like the OP got it working! On my own part, I'm in the same ship
as you: I've never seen it work.
> > The problem is that I haven't been able to make "font" work, no
> > matter the font size. I would be very happy if I am able to use
> > different fonts even with the size limitation (that's not a
> > problem, really), just for the sake of it ;)
> >
> > I've tried with many combinations, but without any success...
>
> As I said, I haven't actually tried it. Which GUI are you using?
GTK2
> Maybe only GTK2 (or something) can do it? Remember that you give the
> point size but it's the pixel size which much be the same, in all
> four of height, width, ascent and descent.
I was assuming that, for small sizes (10-12 points maybe) the pixel size
for H, W, A and D would be roughly the same, or at least similar enough
to cause only minor redrawing problems. Which, BTW, may be the problem I
was having when using hiragana fonts, as I'm pretty sure that Pango was
using another font (not "guifont") for rendering hiragana... On the
other hand I've never used Pango myself, so I'm not sure if it uses HWAD
or another method of computing font dimensions to calculate where to put
the next line. Someday I may take a look at the sources O:)
Raúl "DervishD" Núñez de Arenas Coronado
On Thu, 24 Apr 2008 02:58:23 -0700 (PDT), ThoML dixit:
I've yet to make it work, even with problems. And I must confess I won't
use it for tag-cloud-like text, but for making some part of the text a
bit smaller than the rest so they don't clutter me visually, without
having to resort to color that text with a low-visibility scheme or
using folds.