-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Removed unused variables etc. #22160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,7 +182,6 @@ def subset_font(font_in, font_out, unicodes, opts): | |
|
||
def getsubset(subset, font_in): | ||
subsets = subset.split('+') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the code below, my guess is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it probably was, but it works since subset is a string. Tried to make a minimal change (and tried to search for the original code, but to no avail). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for changing the code below (or leaving as is for now with a comment if you don't dare to change it). This code has been unchanged since it's addition in 2015, so there is no history to dig up. Anyway, it's pretty obvious that this was an oversight and only accidentally worked. Checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK! I'll change it. Both ways should work and using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are correct. One can probably find such cases. |
||
|
||
quotes = [ | ||
0x2013, # endash | ||
0x2014, # emdash | ||
|
@@ -220,16 +219,16 @@ def getsubset(subset, font_in): | |
|
||
result = quotes | ||
|
||
if 'menu' in subset: | ||
if 'menu' in subsets: | ||
font = fontforge.open(font_in) | ||
result = [ | ||
*map(ord, font.familyname), | ||
0x0020, | ||
] | ||
|
||
if 'latin' in subset: | ||
if 'latin' in subsets: | ||
result += latin | ||
if 'latin-ext' in subset: | ||
if 'latin-ext' in subsets: | ||
# These ranges include Extended A, B, C, D, and Additional with the | ||
# exception of Vietnamese, which is a separate range | ||
result += [ | ||
|
@@ -240,7 +239,7 @@ def getsubset(subset, font_in): | |
*range(0x2c60, 0x2c80), | ||
*range(0xa700, 0xa800), | ||
] | ||
if 'vietnamese' in subset: | ||
if 'vietnamese' in subsets: | ||
# 2011-07-16 DC: Charset from | ||
# http://vietunicode.sourceforge.net/charset/ + U+1ef9 from Fontaine | ||
result += [0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00C8, 0x00C9, | ||
|
@@ -251,16 +250,16 @@ def getsubset(subset, font_in): | |
0x00FA, 0x00FD, 0x0102, 0x0103, 0x0110, 0x0111, | ||
0x0128, 0x0129, 0x0168, 0x0169, 0x01A0, 0x01A1, | ||
0x01AF, 0x01B0, 0x20AB, *range(0x1EA0, 0x1EFA)] | ||
if 'greek' in subset: | ||
if 'greek' in subsets: | ||
# Could probably be more aggressive here and exclude archaic | ||
# characters, but lack data | ||
result += [*range(0x370, 0x400)] | ||
if 'greek-ext' in subset: | ||
if 'greek-ext' in subsets: | ||
result += [*range(0x370, 0x400), *range(0x1f00, 0x2000)] | ||
if 'cyrillic' in subset: | ||
if 'cyrillic' in subsets: | ||
# Based on character frequency analysis | ||
result += [*range(0x400, 0x460), 0x490, 0x491, 0x4b0, 0x4b1, 0x2116] | ||
if 'cyrillic-ext' in subset: | ||
if 'cyrillic-ext' in subsets: | ||
result += [ | ||
*range(0x400, 0x530), | ||
0x20b4, | ||
|
@@ -270,7 +269,7 @@ def getsubset(subset, font_in): | |
*range(0x2de0, 0x2e00), | ||
*range(0xa640, 0xa6a0), | ||
] | ||
if 'arabic' in subset: | ||
if 'arabic' in subsets: | ||
# Based on Droid Arabic Kufi 1.0 | ||
result += [0x000D, 0x0020, 0x0621, 0x0627, 0x062D, | ||
0x062F, 0x0631, 0x0633, 0x0635, 0x0637, 0x0639, | ||
|
@@ -322,7 +321,7 @@ def getsubset(subset, font_in): | |
0x063b, 0x063c, 0x063d, 0x063e, 0x063f, 0x0620, | ||
0x0674, 0x0674, 0x06EC] | ||
|
||
if 'dejavu-ext' in subset: | ||
if 'dejavu-ext' in subsets: | ||
# add all glyphnames ending in .display | ||
font = fontforge.open(font_in) | ||
for glyph in font.glyphs(): | ||
|
@@ -335,10 +334,10 @@ def getsubset(subset, font_in): | |
# code for extracting vertical metrics from a TrueType font | ||
class Sfnt: | ||
def __init__(self, data): | ||
version, numTables, _, _, _ = struct.unpack('>IHHHH', data[:12]) | ||
_, numTables, _, _, _ = struct.unpack('>IHHHH', data[:12]) | ||
self.tables = {} | ||
for i in range(numTables): | ||
tag, checkSum, offset, length = struct.unpack( | ||
tag, _, offset, length = struct.unpack( | ||
'>4sIII', data[12 + 16 * i: 28 + 16 * i]) | ||
self.tables[tag] = data[offset: offset + length] | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My code analysis tool said that
sides
andpad_to
was unused. I assume that they should be passed on (as otherwise these will not have any effect when callingcohere
on anAxes
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that should be passed on. Seems it never worked, but nobody ever complained... You can correct this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are passed on.