unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* font name not decoded in the output of describe-font
@ 2008-12-13 14:18 brep
  2008-12-13 17:55 ` Jason Rumney
  2008-12-14 14:16 ` brep
  0 siblings, 2 replies; 10+ messages in thread
From: brep @ 2008-12-13 14:18 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Emacs 23.60.1 on Windows XP chinese simplified editon, the result of describe-font looks like this:
<------------------------------------------>
         character: 中 (20013, #o47055, #x4e2d)
preferred charset: chinese-gbk (GBK Chinese simplified.)
       code point: 0xD6D0
           syntax: w  which means: word
         category: C:2-byte han
Chinese (Han) characters of 2-byte character sets c:Chinese h:Korean j:Japanese
     |:line breakable
While filling, we can break a line at this character.
      buffer code: #xE4 #xB8 #xAD
        file code: #xD6 #xD0 (encoded by coding system chinese-gbk-unix)
          display: by this font (glyph code)
    uniscribe:-outline-\316\242\310\355\321\305\272\332-normal-normal-normal-sans-20-*-*-*-p-*-iso8859-1 (#x419)
<------------------------------------------>
The font name is not decoded, and revealed as internal representation.
btw, M-x set-default-font RET TAB TAB gives a *Completions* buffer, the list of font names also have the same problem, font names are not decoded.

[-- Attachment #2: Type: text/html, Size: 1568 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-13 14:18 font name not decoded in the output of describe-font brep
@ 2008-12-13 17:55 ` Jason Rumney
  2008-12-16  1:36   ` Miles Bader
  2008-12-14 14:16 ` brep
  1 sibling, 1 reply; 10+ messages in thread
From: Jason Rumney @ 2008-12-13 17:55 UTC (permalink / raw)
  To: brep; +Cc: emacs-devel

brep wrote:
> uniscribe:-outline-\316\242\310\355\321\305\272\332-normal-normal-normal-sans-20-*-*-*-p-*-iso8859-1 
> (#x419)
> <------------------------------------------>
> The font name is not decoded, and revealed as internal representation.

I've added code to decode and encode font names in the w32 font backends.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re:Re: font name not decoded in the output of describe-font
  2008-12-13 14:18 font name not decoded in the output of describe-font brep
  2008-12-13 17:55 ` Jason Rumney
@ 2008-12-14 14:16 ` brep
  1 sibling, 0 replies; 10+ messages in thread
From: brep @ 2008-12-14 14:16 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

在2008-12-14,"Jason Rumney" <jasonr@f2s.com> 写道:
>brep wrote:
>> uniscribe:-outline-\316\242\310\355\321\305\272\332-normal-normal-normal-sans-20-*-*-*-p-*-iso8859-1 
>> (#x419)
>> <------------------------------------------>
>> The font name is not decoded, and revealed as internal representation.
>
>I've added code to decode and encode font names in the w32 font backends.
The bug is fixed, thanks.

[-- Attachment #2: Type: text/html, Size: 572 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-13 17:55 ` Jason Rumney
@ 2008-12-16  1:36   ` Miles Bader
  2008-12-16  1:46     ` jasonr
  0 siblings, 1 reply; 10+ messages in thread
From: Miles Bader @ 2008-12-16  1:36 UTC (permalink / raw)
  To: Jason Rumney; +Cc: brep, emacs-devel

Jason Rumney <jasonr@f2s.com> writes:
>> The font name is not decoded, and revealed as internal representation.
>
> I've added code to decode and encode font names in the w32 font backends.

The same problem exists in the output of `C-u C-x ='; I thought
Handa-san said he was going to fix it, but... maybe he forgot?

-Miles

-- 
Opposition, n. In politics the party that prevents the Goverment from running
amok by hamstringing it.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-16  1:36   ` Miles Bader
@ 2008-12-16  1:46     ` jasonr
  2008-12-16  4:44       ` Kenichi Handa
  0 siblings, 1 reply; 10+ messages in thread
From: jasonr @ 2008-12-16  1:46 UTC (permalink / raw)
  To: Miles Bader; +Cc: brep, emacs-devel

Quoting Miles Bader <miles@gnu.org>:

> Jason Rumney <jasonr@f2s.com> writes:
> >> The font name is not decoded, and revealed as internal representation.
> >
> > I've added code to decode and encode font names in the w32 font backends.
>
> The same problem exists in the output of `C-u C-x ='; I thought
> Handa-san said he was going to fix it, but... maybe he forgot?

He said that the fix will need to be specific to each font backend.
I fixed the W32 font backends to decode the font name, but the problem may still
exist in other backends.

My understanding is that Truetype fonts that contain localised names also
contain an ASCII name. On Windows the localised name is only used when the
system locale matches. I don't know under what circumstances if any xft uses
the localised truetype font names. And whether localised names are used in
other font types, and how to tell the encoding.







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-16  1:46     ` jasonr
@ 2008-12-16  4:44       ` Kenichi Handa
  2008-12-16  8:17         ` Stephen J. Turnbull
  0 siblings, 1 reply; 10+ messages in thread
From: Kenichi Handa @ 2008-12-16  4:44 UTC (permalink / raw)
  To: jasonr; +Cc: emacs-devel, brep, miles

In article <1229391969.494708614ac3b@webmail.freedom2surf.net>, jasonr@f2s.com writes:

> Quoting Miles Bader <miles@gnu.org>:
> > Jason Rumney <jasonr@f2s.com> writes:
> > >> The font name is not decoded, and revealed as internal representation.
> > >
> > > I've added code to decode and encode font names in the w32 font backends.
> >
> > The same problem exists in the output of `C-u C-x ='; I thought
> > Handa-san said he was going to fix it, but... maybe he forgot?

Ah, yes, sorry.

> He said that the fix will need to be specific to each font backend.
> I fixed the W32 font backends to decode the font name, but the problem may still
> exist in other backends.

> My understanding is that Truetype fonts that contain localised names also
> contain an ASCII name. On Windows the localised name is only used when the
> system locale matches. I don't know under what circumstances if any xft uses
> the localised truetype font names. And whether localised names are used in
> other font types, and how to tell the encoding.

At least, X font-backend has to decode a font name by
iso-8859-1 if the name has 8-bit code (but I've never seen
such a font).

For Xft backend, the problem is fontconfig.  It seems that
it always provide an UTF-8 encoded name, but I couldn't find
a document saying that clearly.  This page:

http://fontconfig.org/fontconfig-devel/x19.html#AEN27

says only this:

    Property       CPP Symbol           Type    Description
    ----------------------------------------------------
    family         FC_FAMILY            String  Font family names
    familylang     FC_FAMILYLANG        String  Language cooresponding to
                                                each family name
 
---
Kenichi Handa
handa@m17n.org




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-16  4:44       ` Kenichi Handa
@ 2008-12-16  8:17         ` Stephen J. Turnbull
  2008-12-16  8:52           ` Miles Bader
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen J. Turnbull @ 2008-12-16  8:17 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: miles, jasonr, brep, emacs-devel

Kenichi Handa writes:

 > For Xft backend, the problem is fontconfig.  It seems that
 > it always provide an UTF-8 encoded name, but I couldn't find
 > a document saying that clearly.

I haven't found a specification that says so myself, but Aidan Kehoe
says it's clear from the source of fontconfig that it's UTF-8.  I
can't imagine why that would change in the future so it's probably
safe to assume it (at least for user presentation purposes).





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-16  8:17         ` Stephen J. Turnbull
@ 2008-12-16  8:52           ` Miles Bader
  2008-12-17  4:37             ` Stephen J. Turnbull
  2008-12-19  5:44             ` Kenichi Handa
  0 siblings, 2 replies; 10+ messages in thread
From: Miles Bader @ 2008-12-16  8:52 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: emacs-devel, jasonr, brep, Kenichi Handa

"Stephen J. Turnbull" <stephen@xemacs.org> writes:
> I haven't found a specification that says so myself, but Aidan Kehoe
> says it's clear from the source of fontconfig that it's UTF-8.  I
> can't imagine why that would change in the future so it's probably
> safe to assume it (at least for user presentation purposes).

Anyway, since in practice everything uses utf-8, surely it's better to
assume that until a better solution is found, than returning raw
undecoded font names ?

-Miles

-- 
Clarionet, n. An instrument of torture operated by a person with cotton in his
ears. There are two instruments that are worse than a clarionet -- two
clarionets.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-16  8:52           ` Miles Bader
@ 2008-12-17  4:37             ` Stephen J. Turnbull
  2008-12-19  5:44             ` Kenichi Handa
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen J. Turnbull @ 2008-12-17  4:37 UTC (permalink / raw)
  To: Miles Bader; +Cc: Kenichi Handa, jasonr, brep, emacs-devel

Miles Bader writes:
 > "Stephen J. Turnbull" <stephen@xemacs.org> writes:
 > > I haven't found a specification that says so myself, but Aidan Kehoe
 > > says it's clear from the source of fontconfig that it's UTF-8.  I
 > > can't imagine why that would change in the future so it's probably
 > > safe to assume it (at least for user presentation purposes).
 > 
 > Anyway, since in practice everything uses utf-8, surely it's better to
 > assume that until a better solution is found, than returning raw
 > undecoded font names ?

Indeed.  The question in my mind is how defensive to be about checking
for UTF-8 compatibility.  I think it's OK to just decode willy-nilly
and let the errors come if they will (because I'm quite sure they won't).




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font name not decoded in the output of describe-font
  2008-12-16  8:52           ` Miles Bader
  2008-12-17  4:37             ` Stephen J. Turnbull
@ 2008-12-19  5:44             ` Kenichi Handa
  1 sibling, 0 replies; 10+ messages in thread
From: Kenichi Handa @ 2008-12-19  5:44 UTC (permalink / raw)
  To: Miles Bader; +Cc: stephen, jasonr, brep, emacs-devel

In article <buo8wqg8psl.fsf@dhapc248.dev.necel.com>, Miles Bader <miles@gnu.org> writes:

> "Stephen J. Turnbull" <stephen@xemacs.org> writes:
> > I haven't found a specification that says so myself, but Aidan Kehoe
> > says it's clear from the source of fontconfig that it's UTF-8.  I
> > can't imagine why that would change in the future so it's probably
> > safe to assume it (at least for user presentation purposes).

> Anyway, since in practice everything uses utf-8, surely it's better to
> assume that until a better solution is found, than returning raw
> undecoded font names ?

Ok, I've just installed a code to decode/encode font names
property for x, xft, ftx font-backends.

The decoder checks the validity of utf-8 sequence.

---
Kenichi Handa
handa@m17n.org




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-12-19  5:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-13 14:18 font name not decoded in the output of describe-font brep
2008-12-13 17:55 ` Jason Rumney
2008-12-16  1:36   ` Miles Bader
2008-12-16  1:46     ` jasonr
2008-12-16  4:44       ` Kenichi Handa
2008-12-16  8:17         ` Stephen J. Turnbull
2008-12-16  8:52           ` Miles Bader
2008-12-17  4:37             ` Stephen J. Turnbull
2008-12-19  5:44             ` Kenichi Handa
2008-12-14 14:16 ` brep

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).