{"action":"created","comment":{"url":"https://api.github.com/repos/fonttools/fonttools/pulls/comments/233921600","pull_request_review_id":175447851,"id":233921600,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzkyMTYwMA==","diff_hunk":"@@ -0,0 +1,246 @@\n+import os\n+from fontTools.misc.py23 import BytesIO\n+from fontTools.cffLib import (TopDictIndex,\n+\t\t\t\t\t\t\t  buildOrder,\n+\t\t\t\t\t\t\t  topDictOperators,\n+\t\t\t\t\t\t\t  topDictOperators2,\n+\t\t\t\t\t\t\t  privateDictOperators,\n+\t\t\t\t\t\t\t  privateDictOperators2,\n+\t\t\t\t\t\t\t  FDArrayIndex,\n+\t\t\t\t\t\t\t  FontDict,\n+\t\t\t\t\t\t\t  VarStoreData)\n+from fontTools.cffLib.cff2mergePen import CFF2CharStringMergePen\n+from fontTools.ttLib import newTable\n+from fontTools import varLib\n+\n+\n+def addCFFVarStore(varFont, varModel):\n+\tsupports = varModel.supports[1:]\n+\tfvarTable = varFont['fvar']\n+\taxisKeys = [axis.axisTag for axis in fvarTable.axes]\n+\tvarTupleList = varLib.builder.buildVarRegionList(supports, axisKeys)\n+\tvarTupleIndexes = list(range(len(supports)))\n+\tvarDeltasCFFV = varLib.builder.buildVarData(varTupleIndexes, None, False)\n+\tvarStoreCFFV = varLib.builder.buildVarStore(varTupleList, [varDeltasCFFV])\n+\n+\ttopDict = varFont['CFF2'].cff.topDictIndex[0]\n+\ttopDict.VarStore = VarStoreData(otVarStore=varStoreCFFV)\n+\n+\n+def lib_convertCFFToCFF2(cff, otFont):\n+\t# This assumes a decompiled CFF table.\n+\tcff2GetGlyphOrder = cff.otFont.getGlyphOrder\n+\ttopDictData = TopDictIndex(None, cff2GetGlyphOrder, None)\n+\ttopDictData.items = cff.topDictIndex.items\n+\tcff.topDictIndex = topDictData\n+\ttopDict = topDictData[0]\n+\tif hasattr(topDict, 'Private'):\n+\t\tprivateDict = topDict.Private\n+\telse:\n+\t\tprivateDict = None\n+\topOrder = buildOrder(topDictOperators2)\n+\ttopDict.order = opOrder\n+\ttopDict.cff2GetGlyphOrder = cff2GetGlyphOrder\n+\tif not hasattr(topDict, \"FDArray\"):\n+\t\tfdArray = topDict.FDArray = FDArrayIndex()\n+\t\tfdArray.strings = None\n+\t\tfdArray.GlobalSubrs = topDict.GlobalSubrs\n+\t\ttopDict.GlobalSubrs.fdArray = fdArray\n+\t\tcharStrings = topDict.CharStrings\n+\t\tif charStrings.charStringsAreIndexed:\n+\t\t\tcharStrings.charStringsIndex.fdArray = fdArray\n+\t\telse:\n+\t\t\tcharStrings.fdArray = fdArray\n+\t\tfontDict = FontDict()\n+\t\tfontDict.setCFF2(True)\n+\t\tfdArray.append(fontDict)\n+\t\tfontDict.Private = privateDict\n+\t\tprivateOpOrder = buildOrder(privateDictOperators2)\n+\t\tfor entry in privateDictOperators:\n+\t\t\tkey = entry[1]\n+\t\t\tif key not in privateOpOrder:\n+\t\t\t\tif key in privateDict.rawDict:\n+\t\t\t\t\t# print \"Removing private dict\", key\n+\t\t\t\t\tdel privateDict.rawDict[key]\n+\t\t\t\tif hasattr(privateDict, key):\n+\t\t\t\t\tdelattr(privateDict, key)\n+\t\t\t\t\t# print \"Removing privateDict attr\", key\n+\telse:\n+\t\t# clean up the PrivateDicts in the fdArray\n+\t\tfdArray = topDict.FDArray\n+\t\tprivateOpOrder = buildOrder(privateDictOperators2)\n+\t\tfor fontDict in fdArray:\n+\t\t\tfontDict.setCFF2(True)\n+\t\t\tfor key in fontDict.rawDict.keys():\n+\t\t\t\tif key not in fontDict.order:\n+\t\t\t\t\tdel fontDict.rawDict[key]\n+\t\t\t\t\tif hasattr(fontDict, key):\n+\t\t\t\t\t\tdelattr(fontDict, key)\n+\n+\t\t\tprivateDict = fontDict.Private\n+\t\t\tfor entry in privateDictOperators:\n+\t\t\t\tkey = entry[1]\n+\t\t\t\tif key not in privateOpOrder:\n+\t\t\t\t\tif key in privateDict.rawDict:\n+\t\t\t\t\t\t# print \"Removing private dict\", key\n+\t\t\t\t\t\tdel privateDict.rawDict[key]\n+\t\t\t\t\tif hasattr(privateDict, key):\n+\t\t\t\t\t\tdelattr(privateDict, key)\n+\t\t\t\t\t\t# print \"Removing privateDict attr\", key\n+\t# Now delete up the decrecated topDict operators from CFF 1.0\n+\tfor entry in topDictOperators:\n+\t\tkey = entry[1]\n+\t\tif key not in opOrder:\n+\t\t\tif key in topDict.rawDict:\n+\t\t\t\tdel topDict.rawDict[key]\n+\t\t\tif hasattr(topDict, key):\n+\t\t\t\tdelattr(topDict, key)\n+\n+\t# At this point, the Subrs and Charstrings are all still T2Charstring class\n+\t# easiest to fix this by compiling, then decompiling again\n+\tcff.major = 2\n+\tfile = BytesIO()\n+\tcff.compile(file, otFont, isCFF2=True)\n+\tfile.seek(0)\n+\tcff.decompile(file, otFont, isCFF2=True)\n+\n+\n+def pointsDiffer(pointList):","path":"Lib/fontTools/cffLib/cff2_merge_funcs.py","position":108,"original_position":108,"commit_id":"a460eee80bbb238c3707ac02fbd7548272f65200","original_commit_id":"a460eee80bbb238c3707ac02fbd7548272f65200","user":{"login":"behdad","id":142891,"node_id":"MDQ6VXNlcjE0Mjg5MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/142891?v=4","gravatar_id":"","url":"https://api.github.com/users/behdad","html_url":"https://github.com/behdad","followers_url":"https://api.github.com/users/behdad/followers","following_url":"https://api.github.com/users/behdad/following{/other_user}","gists_url":"https://api.github.com/users/behdad/gists{/gist_id}","starred_url":"https://api.github.com/users/behdad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behdad/subscriptions","organizations_url":"https://api.github.com/users/behdad/orgs","repos_url":"https://api.github.com/users/behdad/repos","events_url":"https://api.github.com/users/behdad/events{/privacy}","received_events_url":"https://api.github.com/users/behdad/received_events","type":"User","site_admin":false},"body":"`varLib.models.allEqual()`?","created_at":"2018-11-15T16:44:11Z","updated_at":"2018-11-15T16:44:11Z","html_url":"https://github.com/fonttools/fonttools/pull/1378#discussion_r233921600","pull_request_url":"https://api.github.com/repos/fonttools/fonttools/pulls/1378","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/fonttools/fonttools/pulls/comments/233921600"},"html":{"href":"https://github.com/fonttools/fonttools/pull/1378#discussion_r233921600"},"pull_request":{"href":"https://api.github.com/repos/fonttools/fonttools/pulls/1378"}}},"pull_request":{"url":"https://api.github.com/repos/fonttools/fonttools/pulls/1378","id":230932708,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwOTMyNzA4","html_url":"https://github.com/fonttools/fonttools/pull/1378","diff_url":"https://github.com/fonttools/fonttools/pull/1378.diff","patch_url":"https://github.com/fonttools/fonttools/pull/1378.patch","issue_url":"https://api.github.com/repos/fonttools/fonttools/issues/1378","number":1378,"state":"open","locked":false,"title":"[varLib]Add support for building CFF2 variable font","user":{"login":"readroberts","id":2856984,"node_id":"MDQ6VXNlcjI4NTY5ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2856984?v=4","gravatar_id":"","url":"https://api.github.com/users/readroberts","html_url":"https://github.com/readroberts","followers_url":"https://api.github.com/users/readroberts/followers","following_url":"https://api.github.com/users/readroberts/following{/other_user}","gists_url":"https://api.github.com/users/readroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/readroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readroberts/subscriptions","organizations_url":"https://api.github.com/users/readroberts/orgs","repos_url":"https://api.github.com/users/readroberts/repos","events_url":"https://api.github.com/users/readroberts/events{/privacy}","received_events_url":"https://api.github.com/users/readroberts/received_events","type":"User","site_admin":false},"body":"This pull request replaces https://github.com/fonttools/fonttools/pull/1345; I moved the changes to branch off a more recent state of master.","created_at":"2018-11-14T18:13:42Z","updated_at":"2018-11-15T16:44:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6387ade93327a9f67f8d979266e9137a8f7167c0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fonttools/fonttools/pulls/1378/commits","review_comments_url":"https://api.github.com/repos/fonttools/fonttools/pulls/1378/comments","review_comment_url":"https://api.github.com/repos/fonttools/fonttools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fonttools/fonttools/issues/1378/comments","statuses_url":"https://api.github.com/repos/fonttools/fonttools/statuses/a460eee80bbb238c3707ac02fbd7548272f65200","head":{"label":"fonttools:varlib-build-cff2vf","ref":"varlib-build-cff2vf","sha":"a460eee80bbb238c3707ac02fbd7548272f65200","user":{"login":"fonttools","id":20555868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNTU1ODY4","avatar_url":"https://avatars3.githubusercontent.com/u/20555868?v=4","gravatar_id":"","url":"https://api.github.com/users/fonttools","html_url":"https://github.com/fonttools","followers_url":"https://api.github.com/users/fonttools/followers","following_url":"https://api.github.com/users/fonttools/following{/other_user}","gists_url":"https://api.github.com/users/fonttools/gists{/gist_id}","starred_url":"https://api.github.com/users/fonttools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fonttools/subscriptions","organizations_url":"https://api.github.com/users/fonttools/orgs","repos_url":"https://api.github.com/users/fonttools/repos","events_url":"https://api.github.com/users/fonttools/events{/privacy}","received_events_url":"https://api.github.com/users/fonttools/received_events","type":"Organization","site_admin":false},"repo":{"id":11639637,"node_id":"MDEwOlJlcG9zaXRvcnkxMTYzOTYzNw==","name":"fonttools","full_name":"fonttools/fonttools","private":false,"owner":{"login":"fonttools","id":20555868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNTU1ODY4","avatar_url":"https://avatars3.githubusercontent.com/u/20555868?v=4","gravatar_id":"","url":"https://api.github.com/users/fonttools","html_url":"https://github.com/fonttools","followers_url":"https://api.github.com/users/fonttools/followers","following_url":"https://api.github.com/users/fonttools/following{/other_user}","gists_url":"https://api.github.com/users/fonttools/gists{/gist_id}","starred_url":"https://api.github.com/users/fonttools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fonttools/subscriptions","organizations_url":"https://api.github.com/users/fonttools/orgs","repos_url":"https://api.github.com/users/fonttools/repos","events_url":"https://api.github.com/users/fonttools/events{/privacy}","received_events_url":"https://api.github.com/users/fonttools/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/fonttools/fonttools","description":"A library to manipulate font files from Python.","fork":false,"url":"https://api.github.com/repos/fonttools/fonttools","forks_url":"https://api.github.com/repos/fonttools/fonttools/forks","keys_url":"https://api.github.com/repos/fonttools/fonttools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fonttools/fonttools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fonttools/fonttools/teams","hooks_url":"https://api.github.com/repos/fonttools/fonttools/hooks","issue_events_url":"https://api.github.com/repos/fonttools/fonttools/issues/events{/number}","events_url":"https://api.github.com/repos/fonttools/fonttools/events","assignees_url":"https://api.github.com/repos/fonttools/fonttools/assignees{/user}","branches_url":"https://api.github.com/repos/fonttools/fonttools/branches{/branch}","tags_url":"https://api.github.com/repos/fonttools/fonttools/tags","blobs_url":"https://api.github.com/repos/fonttools/fonttools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fonttools/fonttools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fonttools/fonttools/git/refs{/sha}","trees_url":"https://api.github.com/repos/fonttools/fonttools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fonttools/fonttools/statuses/{sha}","languages_url":"https://api.github.com/repos/fonttools/fonttools/languages","stargazers_url":"https://api.github.com/repos/fonttools/fonttools/stargazers","contributors_url":"https://api.github.com/repos/fonttools/fonttools/contributors","subscribers_url":"https://api.github.com/repos/fonttools/fonttools/subscribers","subscription_url":"https://api.github.com/repos/fonttools/fonttools/subscription","commits_url":"https://api.github.com/repos/fonttools/fonttools/commits{/sha}","git_commits_url":"https://api.github.com/repos/fonttools/fonttools/git/commits{/sha}","comments_url":"https://api.github.com/repos/fonttools/fonttools/comments{/number}","issue_comment_url":"https://api.github.com/repos/fonttools/fonttools/issues/comments{/number}","contents_url":"https://api.github.com/repos/fonttools/fonttools/contents/{+path}","compare_url":"https://api.github.com/repos/fonttools/fonttools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fonttools/fonttools/merges","archive_url":"https://api.github.com/repos/fonttools/fonttools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fonttools/fonttools/downloads","issues_url":"https://api.github.com/repos/fonttools/fonttools/issues{/number}","pulls_url":"https://api.github.com/repos/fonttools/fonttools/pulls{/number}","milestones_url":"https://api.github.com/repos/fonttools/fonttools/milestones{/number}","notifications_url":"https://api.github.com/repos/fonttools/fonttools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fonttools/fonttools/labels{/name}","releases_url":"https://api.github.com/repos/fonttools/fonttools/releases{/id}","deployments_url":"https://api.github.com/repos/fonttools/fonttools/deployments","created_at":"2013-07-24T16:28:35Z","updated_at":"2018-11-15T08:53:27Z","pushed_at":"2018-11-15T16:34:45Z","git_url":"git://github.com/fonttools/fonttools.git","ssh_url":"git@github.com:fonttools/fonttools.git","clone_url":"https://github.com/fonttools/fonttools.git","svn_url":"https://github.com/fonttools/fonttools","homepage":"https://groups.google.com/d/forum/fonttools","size":14026,"stargazers_count":1414,"watchers_count":1414,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":204,"mirror_url":null,"archived":false,"open_issues_count":275,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":204,"open_issues":275,"watchers":1414,"default_branch":"master"}},"base":{"label":"fonttools:master","ref":"master","sha":"49772b136fe43d62198b3632e6337f29afd0ed3f","user":{"login":"fonttools","id":20555868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNTU1ODY4","avatar_url":"https://avatars3.githubusercontent.com/u/20555868?v=4","gravatar_id":"","url":"https://api.github.com/users/fonttools","html_url":"https://github.com/fonttools","followers_url":"https://api.github.com/users/fonttools/followers","following_url":"https://api.github.com/users/fonttools/following{/other_user}","gists_url":"https://api.github.com/users/fonttools/gists{/gist_id}","starred_url":"https://api.github.com/users/fonttools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fonttools/subscriptions","organizations_url":"https://api.github.com/users/fonttools/orgs","repos_url":"https://api.github.com/users/fonttools/repos","events_url":"https://api.github.com/users/fonttools/events{/privacy}","received_events_url":"https://api.github.com/users/fonttools/received_events","type":"Organization","site_admin":false},"repo":{"id":11639637,"node_id":"MDEwOlJlcG9zaXRvcnkxMTYzOTYzNw==","name":"fonttools","full_name":"fonttools/fonttools","private":false,"owner":{"login":"fonttools","id":20555868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNTU1ODY4","avatar_url":"https://avatars3.githubusercontent.com/u/20555868?v=4","gravatar_id":"","url":"https://api.github.com/users/fonttools","html_url":"https://github.com/fonttools","followers_url":"https://api.github.com/users/fonttools/followers","following_url":"https://api.github.com/users/fonttools/following{/other_user}","gists_url":"https://api.github.com/users/fonttools/gists{/gist_id}","starred_url":"https://api.github.com/users/fonttools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fonttools/subscriptions","organizations_url":"https://api.github.com/users/fonttools/orgs","repos_url":"https://api.github.com/users/fonttools/repos","events_url":"https://api.github.com/users/fonttools/events{/privacy}","received_events_url":"https://api.github.com/users/fonttools/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/fonttools/fonttools","description":"A library to manipulate font files from Python.","fork":false,"url":"https://api.github.com/repos/fonttools/fonttools","forks_url":"https://api.github.com/repos/fonttools/fonttools/forks","keys_url":"https://api.github.com/repos/fonttools/fonttools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fonttools/fonttools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fonttools/fonttools/teams","hooks_url":"https://api.github.com/repos/fonttools/fonttools/hooks","issue_events_url":"https://api.github.com/repos/fonttools/fonttools/issues/events{/number}","events_url":"https://api.github.com/repos/fonttools/fonttools/events","assignees_url":"https://api.github.com/repos/fonttools/fonttools/assignees{/user}","branches_url":"https://api.github.com/repos/fonttools/fonttools/branches{/branch}","tags_url":"https://api.github.com/repos/fonttools/fonttools/tags","blobs_url":"https://api.github.com/repos/fonttools/fonttools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fonttools/fonttools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fonttools/fonttools/git/refs{/sha}","trees_url":"https://api.github.com/repos/fonttools/fonttools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fonttools/fonttools/statuses/{sha}","languages_url":"https://api.github.com/repos/fonttools/fonttools/languages","stargazers_url":"https://api.github.com/repos/fonttools/fonttools/stargazers","contributors_url":"https://api.github.com/repos/fonttools/fonttools/contributors","subscribers_url":"https://api.github.com/repos/fonttools/fonttools/subscribers","subscription_url":"https://api.github.com/repos/fonttools/fonttools/subscription","commits_url":"https://api.github.com/repos/fonttools/fonttools/commits{/sha}","git_commits_url":"https://api.github.com/repos/fonttools/fonttools/git/commits{/sha}","comments_url":"https://api.github.com/repos/fonttools/fonttools/comments{/number}","issue_comment_url":"https://api.github.com/repos/fonttools/fonttools/issues/comments{/number}","contents_url":"https://api.github.com/repos/fonttools/fonttools/contents/{+path}","compare_url":"https://api.github.com/repos/fonttools/fonttools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fonttools/fonttools/merges","archive_url":"https://api.github.com/repos/fonttools/fonttools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fonttools/fonttools/downloads","issues_url":"https://api.github.com/repos/fonttools/fonttools/issues{/number}","pulls_url":"https://api.github.com/repos/fonttools/fonttools/pulls{/number}","milestones_url":"https://api.github.com/repos/fonttools/fonttools/milestones{/number}","notifications_url":"https://api.github.com/repos/fonttools/fonttools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fonttools/fonttools/labels{/name}","releases_url":"https://api.github.com/repos/fonttools/fonttools/releases{/id}","deployments_url":"https://api.github.com/repos/fonttools/fonttools/deployments","created_at":"2013-07-24T16:28:35Z","updated_at":"2018-11-15T08:53:27Z","pushed_at":"2018-11-15T16:34:45Z","git_url":"git://github.com/fonttools/fonttools.git","ssh_url":"git@github.com:fonttools/fonttools.git","clone_url":"https://github.com/fonttools/fonttools.git","svn_url":"https://github.com/fonttools/fonttools","homepage":"https://groups.google.com/d/forum/fonttools","size":14026,"stargazers_count":1414,"watchers_count":1414,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":204,"mirror_url":null,"archived":false,"open_issues_count":275,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":204,"open_issues":275,"watchers":1414,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fonttools/fonttools/pulls/1378"},"html":{"href":"https://github.com/fonttools/fonttools/pull/1378"},"issue":{"href":"https://api.github.com/repos/fonttools/fonttools/issues/1378"},"comments":{"href":"https://api.github.com/repos/fonttools/fonttools/issues/1378/comments"},"review_comments":{"href":"https://api.github.com/repos/fonttools/fonttools/pulls/1378/comments"},"review_comment":{"href":"https://api.github.com/repos/fonttools/fonttools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fonttools/fonttools/pulls/1378/commits"},"statuses":{"href":"https://api.github.com/repos/fonttools/fonttools/statuses/a460eee80bbb238c3707ac02fbd7548272f65200"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"behdad"}}