From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: [PATCH 04/13] Use NSCharacterCollection instead of CTCharacterCollection Date: Sat, 20 May 2017 16:58:32 +0200 Message-ID: <20170520145841.94282-4-phst@google.com> References: <20170520145841.94282-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1495292371 2854 195.159.176.226 (20 May 2017 14:59:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 20 May 2017 14:59:31 +0000 (UTC) Cc: Philipp Stephani To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 20 16:59:27 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dC5ql-0000Y6-Jr for ged-emacs-devel@m.gmane.org; Sat, 20 May 2017 16:59:23 +0200 Original-Received: from localhost ([::1]:34505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dC5qr-0007sH-6z for ged-emacs-devel@m.gmane.org; Sat, 20 May 2017 10:59:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dC5qg-0007qM-Kg for emacs-devel@gnu.org; Sat, 20 May 2017 10:59:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dC5qe-0003Fp-Fb for emacs-devel@gnu.org; Sat, 20 May 2017 10:59:18 -0400 Original-Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33281) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dC5qe-0003FR-6h for emacs-devel@gnu.org; Sat, 20 May 2017 10:59:16 -0400 Original-Received: by mail-wm0-x242.google.com with SMTP id b84so7459197wmh.0 for ; Sat, 20 May 2017 07:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TB8bAWPqHJnRUZwmz9x750NohIj+JzOHLaWEEkzel1g=; b=I4DeTS7ImyULZ7lOnFQa5x37B0Zn85x1Zp4LQ6S+wyS6jf2qGFM42mZnmztD4Tv4A1 AZytd/QECvDbSKwt/gMU093DdgsPoP0jDZhbk6MSkrtNXTh/FXNf0OoqgnCOHorAQ555 4ZutHQiGUo8FEFZ77fKN0UqBUpKvdZsqPgQ/MOD7XHCH1FSSizaBRqzL2mfC3jvJ+pV/ ZDMNI6gc2ylhMNowPV2THYtAzgwBNf3fi3V8N9mpaIEBNKWHvM5o5dF78s7FV/SX/WH7 ASLsqrW1YZC9T6edevAI9v5ygFRcOHhmwrwp5wVcDstAAtORzkgzyBiNb6Le2QbFNd07 AsHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TB8bAWPqHJnRUZwmz9x750NohIj+JzOHLaWEEkzel1g=; b=YgH1y1ED2DZ2/BnvmRHl9TD7kYbKHWeeG83DI4ksm4xqG5xXiD7sgwJyWT6WikdPWe mzxP5851wKNtWgcBGXdEp/22b09nhSO6G7HleSc0lp6h/s5jhuQFXdvHH2OrqFY5Lpc5 duX+SVRd6n2xxy2YNygT1lzAy2oD2oQPC+BcUtqCedAOpsCG1BldL5p+jbv0sq8YHpn8 MrBFDmGphdErs/K7bwOE/L/L//0a83zPunW7WtUQROw6BKOIef3/PGmhkPjDDfMaWCrO 3uh7qy2xf+200HbfnqVLSb2+NmpqMWhaM3q+rJQqbwpcfK1N4lNFKu2xfbH5WddPNUNb vFtw== X-Gm-Message-State: AODbwcBTI75FlMHrNVMqFRDEz7MxZdJlPMOTUO7D0VQ7LUe1L5sVe5o0 XhCcdkIWvhPx6Loq6kE= X-Received: by 10.28.65.213 with SMTP id o204mr21858368wma.43.1495292354886; Sat, 20 May 2017 07:59:14 -0700 (PDT) Original-Received: from p.cm.cablesurf.de (46.128.198.151.dynamic.cablesurf.de. [46.128.198.151]) by smtp.gmail.com with ESMTPSA id 4sm7795937wrv.33.2017.05.20.07.59.13 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 20 May 2017 07:59:14 -0700 (PDT) X-Google-Original-From: Philipp Stephani X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170520145841.94282-1-phst@google.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215016 Archived-At: This should not cause behavior changes, but fixes a compiler warning due to implicit conversions between the enums. * src/macfont.m (macfont_cache, macfont_lookup_cache) (macfont_get_glyph_for_cid, macfont_get_uvs_table) (macfont_variation_glyphs): Use NSCharacterCollection. --- src/macfont.m | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/macfont.m b/src/macfont.m index f356842db1..b859eb4378 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -206,7 +206,7 @@ static void mac_font_get_glyphs_for_variants (CFDataRef, UTF32Char, #if !USE_CT_GLYPH_INFO static CGGlyph -mac_font_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection, +mac_font_get_glyph_for_cid (CTFontRef font, NSCharacterCollection collection, CGFontIndex cid) { CGGlyph result = kCGFontIndexInvalid; @@ -1321,8 +1321,8 @@ equal to the number of rows that are invalid as BMP (i.e., from /* Character collection specifying the destination of the mapping provided by `table' above. If `table' is obtained from the UVS subtable in the font cmap table, then the value of this member - should be kCTCharacterCollectionIdentityMapping. */ - CTCharacterCollection collection; + should be NSIdentityMappingCharacterCollection. */ + NSCharacterCollection collection; } uvs; }; @@ -1333,8 +1333,8 @@ equal to the number of rows that are invalid as BMP (i.e., from static CFCharacterSetRef macfont_get_cf_charset_for_name (CFStringRef); static CGGlyph macfont_get_glyph_for_character (struct font *, UTF32Char); static CGGlyph macfont_get_glyph_for_cid (struct font *font, - CTCharacterCollection, CGFontIndex); -static CFDataRef macfont_get_uvs_table (struct font *, CTCharacterCollection *); + NSCharacterCollection, CGFontIndex); +static CFDataRef macfont_get_uvs_table (struct font *, NSCharacterCollection *); static struct macfont_cache * macfont_lookup_cache (CFStringRef key) @@ -1582,7 +1582,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, } static CGGlyph -macfont_get_glyph_for_cid (struct font *font, CTCharacterCollection collection, +macfont_get_glyph_for_cid (struct font *font, NSCharacterCollection collection, CGFontIndex cid) { struct macfont_info *macfont_info = (struct macfont_info *) font; @@ -1593,7 +1593,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, } static CFDataRef -macfont_get_uvs_table (struct font *font, CTCharacterCollection *collection) +macfont_get_uvs_table (struct font *font, NSCharacterCollection *collection) { struct macfont_info *macfont_info = (struct macfont_info *) font; CTFontRef macfont = macfont_info->macfont; @@ -1603,12 +1603,12 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, if (cache->uvs.table == NULL) { CFDataRef uvs_table = mac_font_copy_uvs_table (macfont); - CTCharacterCollection uvs_collection = - kCTCharacterCollectionIdentityMapping; + NSCharacterCollection uvs_collection = + NSIdentityMappingCharacterCollection; if (uvs_table == NULL && mac_font_get_glyph_for_cid (macfont, - kCTCharacterCollectionAdobeJapan1, + NSAdobeJapan1CharacterCollection, 6480) != kCGFontIndexInvalid) { /* If the glyph for U+4E55 is accessible via its CID 6480, @@ -1625,7 +1625,7 @@ static CGGlyph macfont_get_glyph_for_cid (struct font *font, if (mac_uvs_table_adobe_japan1) { uvs_table = CFRetain (mac_uvs_table_adobe_japan1); - uvs_collection = kCTCharacterCollectionAdobeJapan1; + uvs_collection = NSAdobeJapan1CharacterCollection; } } if (uvs_table == NULL) @@ -3348,7 +3348,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no macfont_variation_glyphs (struct font *font, int c, unsigned variations[256]) { CFDataRef uvs_table; - CTCharacterCollection uvs_collection; + NSCharacterCollection uvs_collection; int i, n = 0; block_input (); @@ -3368,7 +3368,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no { CGGlyph glyph = glyphs[i]; - if (uvs_collection != kCTCharacterCollectionIdentityMapping + if (uvs_collection != NSIdentityMappingCharacterCollection && glyph != kCGFontIndexInvalid) glyph = macfont_get_glyph_for_cid (font, uvs_collection, glyph); if (glyph == kCGFontIndexInvalid) -- 2.13.0