From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.devel Subject: Re: How to walk a Lisp_String? Date: Fri, 02 Sep 2022 08:51:34 +0200 Message-ID: <875yi68e15.fsf@elite.giraud> References: <87a67jw1kw.fsf@elite.giraud> <83o7vzqey8.fsf@gnu.org> <83mtbjqemd.fsf@gnu.org> <87ler2963r.fsf@elite.giraud> <875yi6mvlx.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11390"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 02 09:11:41 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oU0q5-0002mg-3U for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Sep 2022 09:11:41 +0200 Original-Received: from localhost ([::1]:53210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oU0q3-0001Gy-W0 for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Sep 2022 03:11:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU0Wk-0005wH-7y for emacs-devel@gnu.org; Fri, 02 Sep 2022 02:51:46 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]:17495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU0Wg-0006Jx-Uy; Fri, 02 Sep 2022 02:51:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=GXAXrLZlsnEb8uFU oNlPVFzw3KFi9snv3aGb+tG1+ds=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=namLo9TTmwNpSsheGQphWARrj2hXnrSxRblcxn V01xosk0DUAg1GC4f8lMFG+LYx3i/RsMa1JRIMzHFrlzzNCv+MeV1ZvaxS1Ptz2J/xUC6v Ku2pIutH15m9nZ7mjcYcjRSJolFNkaQx84kY1UgOW7ZAIJwjfPXf1lZPh2Cffl+Gk+wVLZ Habx1CsxpvCNBuSG8+kywhvvHnFn0HohTBenwpX0XhRXiMQsJB8UoDQ0onZKj/ydCuyJMs Mz2sOY78KDuaCHUAuTCZA8XFDORpoh3DcPcWs4Vel+EaGQM3v3hCdlkeOJ2ozFYO0YC/zY X5LnR0kqJFrV6Q0hBfdY/tsQ== Original-Received: from elite.giraud ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 927d0cdb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 2 Sep 2022 08:51:35 +0200 (CEST) In-Reply-To: <875yi6mvlx.fsf@yahoo.com> (Po Lu's message of "Fri, 02 Sep 2022 09:08:10 +0800") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294515 Archived-At: Po Lu writes: > Manuel Giraud writes: > >> Finally, I'd like to walk this Lisp_String and call FACE_FOR_CHAR for >> each charater of this frame. And then be able to call XftDrawStringUtf8 >> (or XmbDrawString) on each substring/font pair. WDYT? > > That won't work correctly since glyphs do not correspond to > characters. > > After you obtain the substring containing characters that can be > displayed with a single font, you should pass it to the font driver's > `shape' function, and then give the resulting glyphs and offsets to > XftDrawGlyphs. Thanks for those hints. What is a "font driver's `shape' function"? > Using XftDrawStringUtf8 is a bad idea, along with any other "UTF-8" > interface provided by an X library. They simply don't work very well, > and cannot handle complicated things such as character compositions and > shaping. Ok. I've said XftDrawStringUtf8 because this is what is currently used in lwlib for cairo or xft. > Using XmbDrawString in conjunction with the Emacs face machinery is > probably a bad idea too, since both have differing notions of "fontset" > and "font". Yes, I think that this design could be for cairo and xft only and that XmbDrawString/XDrawString should stay as they are. -- Manuel Giraud