From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: How to walk a Lisp_String? Date: Fri, 02 Sep 2022 09:08:10 +0800 Message-ID: <875yi6mvlx.fsf@yahoo.com> References: <87a67jw1kw.fsf@elite.giraud> <83o7vzqey8.fsf@gnu.org> <83mtbjqemd.fsf@gnu.org> <87ler2963r.fsf@elite.giraud> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30223"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Manuel Giraud Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 02 03:09:47 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 1oTvBp-0007ae-2U for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Sep 2022 03:09:45 +0200 Original-Received: from localhost ([::1]:56962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTvBn-0002Rk-Qv for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Sep 2022 21:09:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTvAU-0001ky-GP for emacs-devel@gnu.org; Thu, 01 Sep 2022 21:08:22 -0400 Original-Received: from sonic301-30.consmr.mail.ne1.yahoo.com ([66.163.184.199]:44384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTvAS-0007xD-6t for emacs-devel@gnu.org; Thu, 01 Sep 2022 21:08:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1662080898; bh=1fBzuBKPLnRGiRuSI0iWTvzgzAAu0lC9omcoSTdHYUY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=gx1lK/kIn34flpSS8R/Q8w0nVFKEOdE7rbIKqWWDDl+ELkZ4TNJn9M5sCNmZEY6tmB+eB4OOXrAysFyn1P+89ac+IN/eJRMJgHAOezJb2emF83oq7ZbODph2WTqdIk5t/w/QVMZHqmiqshZ4JX34jBWatgKcmcazaQlam6ZDHIZIZUqjbsEgaYQSpa7aOvNRNpT+vgU7+VuS3+KotGVRe6Gs3WBP9lrUkCSMbBFb8b4dJfdv3wsrlJ2CO2h9QJXZTse0/9FhQo4ft+YY8GXbkqwjPkdKbnkFszMg40XsPErGNMcpuxLyeHdjAucwlHXmQcMnE4MT5ElBOSSoeaQwBw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1662080898; bh=dFCelL2/9d2007lA4atpvPbpd2cxzKeWLyaWm/k/jl6=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=XY7ktNdyQTNUlLGsuo0mI4wDbZYVrpH4HhER86dvJwjmg9AaErZ2iVvNaL3ag5sB+7y7vPMK1/xzrdS2/IYYBPQ5pO0aJCTVTieeljWeyyvKpm5jCo6FALmUnjtO7j/124pTSAd9mS2h5l0Qj/1Jirj/OXJ8UuTobXIffnmPJcgaDCOL+JgQP+d0mWc2JuRNb7ba0448F4wBMK8RrVXde3VGrPUGR26ljNkaaTnNX5F54ZHrf97VStStndTR9/MRdb6MD0627SUEIOgzB0lG5cuZnnpaca+ai9RI75lo7SanjglPXSKrUv7V9pzvTfViVqKK11fe/zQCrts8sYGZ+A== X-YMail-OSG: LIncfZkVM1lM20bZkpQOIh6_EiL.xcCfgzRrxvRQwwNBGQY7_T2Q3oTip479SEv cGPCCOef44HY5FR97N3tPe_vsqiQrEJgum3tgaOUqatl9Z_7zJNfNhjmFQMm5s7209xDU.TIBKBu WAqbHhE_ed_Wfj8WY.YI10b2QwMep7GTdWEMrY9b4CS0PvOEbemXHgU5BQV09HBJYiINpKvrwjjB cAWCkzuTrSHf2_VSR52g67Wlt8bR7Afa3FVZT0qWKQjCNclVVcU3c5z5LAAmyZHiAPRtDGwkbjLY xAig_JX12Dvyvbi467iZJ8c8FgraoJtwcYr53h76r4MlgIKCp62A47AqXJgDW.YMr5KXRpGjJpEp wJLhojg90Di8qJlEeWT8hV61Oh2.VjEQp06DGsUy7lZjO3l.YWysa0wwg0u9uInEXm4aqpR1otfy vZUR1t6voP7YIa0M4AW0Cfj2godSecj8UWpUtAyTYJ5pNlxnqkMWNQZJPFRA1N9AI9hu92Kp59BV en9leiQA9p3kFRU6NHviCS.UG45nOIkJkgSFoF6oJzRO.ivIUXYUEWrogmMjO5OLwniO0CmsNhTK mVJJ0CRmbWPb8i6tcITEWGlFGKj_bRBM2V9LWBHRsQrJC6xuamlLnY1ULmK.As5A2ksyYsm5nI4R cyfcRp_LY42Eo3yaSzeUS0wL033b6gbr6GqCMzs8sPU_fg3N7uAX9BybM2gVhItbN5ERNF25oATh Av_N2ZceWdk8h4lbx14nuRkBYxG4a9O4xjR4Y0G59n66diCSGSclIgR9K01g0OAMawhQBr2YAjBV H3Jh_o6TMzndvUCN0bAdqka1NycN.V9O1VPGqQXwr2 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ne1.yahoo.com with HTTP; Fri, 2 Sep 2022 01:08:18 +0000 Original-Received: by hermes--canary-production-sg3-6bb8946c47-n8gf6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 53abb6d549a93a7bc116dd66b71338d4; Fri, 02 Sep 2022 01:08:15 +0000 (UTC) In-Reply-To: <87ler2963r.fsf@elite.giraud> (Manuel Giraud's message of "Thu, 01 Sep 2022 22:45:12 +0200") X-Mailer: WebService/1.1.20595 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.184.199; envelope-from=luangruo@yahoo.com; helo=sonic301-30.consmr.mail.ne1.yahoo.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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:294511 Archived-At: 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. 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. Using XmbDrawString in conjunction with the Emacs face machinery is probably a bad idea too, since both have differing notions of "fontset" and "font".