* bug#14634: 24.3.50; face attributes for font appearance (:font etc.)
@ 2013-06-16 9:15 Drew Adams
2019-11-01 17:14 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2013-06-16 9:15 UTC (permalink / raw)
To: 14634
Trying to figure out how to use face attribute :font, or, since that
does not seem to work, to at least use other font-related face
attributes.
See also bug #14629, which is about the doc for face attribute :font.
Suppose I want to show a string using a `face' text property that
reflects a particular font, as given by its XLFD.
For example, given this value from, say, a frame's `font' parameter:
"-outline-Lucida Bright-bold-italic-normal-serif-14-*-*-*-p-*-iso8859-1"
Suppose I want to propertize that string, for use elsewhere, with
property `face' so that it appears in the same font (WYSIWYG).
If `myfont' is a variable whose value is that XLFD string, you can try
just using the string as the value of face attribute :font:
(propertize myfont 'face (list :font myfont))
But that doesn't work - it seems to have no effect. Too bad.
You can try splitting that XLFD string and using some of the fields:
(let* ((splits (split-string myfont "-"))
(foundry (nth 1 splits))
(family (nth 2 splits))
(weight (nth 3 splits))
(slant (nth 4 splits))
(width (nth 5 splits)))
(propertize
myfont 'face
(list :foundry foundry :family family :weight weight :slant slant
:width width)))
IOW:
(propertize myfont 'face
(list :foundry "outline" :family "Lucida Bright" :weight "bold"
:slant "italic" :width "normal"))
But that doesn't really show the font as it should either. It doesn't
appear italic at all.
And you apparently cannot get the size/height this way (by parsing the
XLFD). There seems to be no correspondence between the value of PIXELS
or HEIGHT from the XLFD and the available face attribute for size (i.e.,
:height).
Nor does there seem to be any correspondence between face attribute
:height and the sizes returned by `font-info' (neither SIZE nor HEIGHT).
(Note that SIZE is not even explained - the `font-info' doc string just
says it is "the pixelsize", whatever that means!)
Why does :height use units of 1/10 point? None of the ways I can find
to get info about a font's size use such units. And its not clear how to
convert what you can obtain from the XLFD or from `font-info' into a
:height value you can use as a face attribute.
Why not make `font-info' return info that can be used as face
attributes?
And why not make face attributes that correspond to the font properties
that Emacs uses elsewhere? (emacs) `Fonts' mentions these, for
"fontconfig patterns": `style' and `spacing' (in addition to `slant',
`weight', and `width'). And for XLFD it mentions all of the XLFD
fields. Why can't we use such info as face attributes?
Am I missing something, or is it a bug that you cannot easily specify a
font's properties as face attributes? In general, this seems quite
confusing and buggy.
And isn't it a bug that specifying :slant "italic" has no effect? That
is easy to see:
emacs -Q
In *scratch*, turn off font-lock-mode, then type this, then hit `C-x C-e':
(put-text-property 92 126
'face (list :foundry "outline"
:family "Lucida Bright"
:weight "bold" :slant "italic"
:width "normal"))
You will see the words "to create a file, visit that file" change font,
but they will not be italic... (I don't think it is bold either, but I
cannot be sure.) `C-u C-x =' shows that the property was applied, but
it is not reflected.
Yet if you use `M-x customize-face default', and you set the family to
"Lucida Bright", the foundry to "outline", the width to "normal", the
weight to "bold", and the slant to "italic", you will see the font as it
should be (bold italic).
In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
of 2013-06-13 on ODIEONE
Bzr revision: 112978 xfq.free@gmail.com-20130613224333-3yfl8navh3c1vmxy
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
CFLAGS='-O0 -g3' CPPFLAGS='-Ic:/Devel/emacs/include'
LDFLAGS='-Lc:/Devel/emacs/lib''
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#14634: 24.3.50; face attributes for font appearance (:font etc.)
2013-06-16 9:15 bug#14634: 24.3.50; face attributes for font appearance (:font etc.) Drew Adams
@ 2019-11-01 17:14 ` Lars Ingebrigtsen
2019-11-01 17:57 ` Drew Adams
0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-01 17:14 UTC (permalink / raw)
To: Drew Adams; +Cc: 14634
Drew Adams <drew.adams@oracle.com> writes:
> emacs -Q
> In *scratch*, turn off font-lock-mode, then type this, then hit `C-x C-e':
>
> (put-text-property 92 126
> 'face (list :foundry "outline"
> :family "Lucida Bright"
> :weight "bold" :slant "italic"
> :width "normal"))
>
> You will see the words "to create a file, visit that file" change font,
> but they will not be italic... (I don't think it is bold either, but I
> cannot be sure.) `C-u C-x =' shows that the property was applied, but
> it is not reflected.
The syntax is with symbols, not strings:
(insert (propertize "foo" 'face (list :foundry "outline"
:family "Lucida Bright"
:weight 'bold :slant 'italic
:width 'normal)))
This isn't mentioned in "Low-Level Font", so I've now done so.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#14634: 24.3.50; face attributes for font appearance (:font etc.)
2019-11-01 17:14 ` Lars Ingebrigtsen
@ 2019-11-01 17:57 ` Drew Adams
2019-11-02 14:31 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2019-11-01 17:57 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 14634
> The syntax is with symbols, not strings:
>
> (insert (propertize "foo" 'face (list :foundry "outline"
> :family "Lucida Bright"
> :weight 'bold :slant 'italic
> :width 'normal)))
>
> This isn't mentioned in "Low-Level Font", so I've now done so.
Thanks.
Could you also please take a look at the related bug #14629? Thx.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#14634: 24.3.50; face attributes for font appearance (:font etc.)
2019-11-01 17:57 ` Drew Adams
@ 2019-11-02 14:31 ` Lars Ingebrigtsen
2019-11-02 15:02 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-02 14:31 UTC (permalink / raw)
To: Drew Adams; +Cc: 14634
Drew Adams <drew.adams@oracle.com> writes:
> Could you also please take a look at the related bug #14629? Thx.
I'm slowly working my way through all the bugs that have "font" in their
subject lines, but that's an earlier one than this one, which means that
I've probably looked at it, but didn't have anything to contribute,
unfortunately.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#14634: 24.3.50; face attributes for font appearance (:font etc.)
2019-11-02 14:31 ` Lars Ingebrigtsen
@ 2019-11-02 15:02 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2019-11-02 15:02 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 14634
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sat, 02 Nov 2019 15:31:29 +0100
> Cc: 14634@debbugs.gnu.org
>
> Drew Adams <drew.adams@oracle.com> writes:
>
> > Could you also please take a look at the related bug #14629? Thx.
>
> I'm slowly working my way through all the bugs that have "font" in their
> subject lines, but that's an earlier one than this one, which means that
> I've probably looked at it, but didn't have anything to contribute,
> unfortunately.
I just did.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-02 15:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-16 9:15 bug#14634: 24.3.50; face attributes for font appearance (:font etc.) Drew Adams
2019-11-01 17:14 ` Lars Ingebrigtsen
2019-11-01 17:57 ` Drew Adams
2019-11-02 14:31 ` Lars Ingebrigtsen
2019-11-02 15:02 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.