This repository has been archived by the owner on Oct 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
download #97
Open
yangffan
wants to merge
138
commits into
googlefonts:main
Choose a base branch
from
rillig:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
download #97
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is difficult to type invisible characters using the keyboard, and unnecessarily time-consuming to write out all letters of the alphabet for creating a subset of a font. A much simpler way to generate the ASCII-only subset is now to run: SfntTool -regex '[ -~]' original.ttf ascii-only.ttf
* The bitmask 0xffffffff does not have any effect when applied to a long value since it is first extended to 64 bits, retaining its arithmetic value of -1, thereby resulting in a nop. * All static methods are implicitly final, therefore it is not necessary to write this in the code. * The pattern "if (condition) return true; else return false;" can be written simpler as "return condition;". * In TagOffsetsTable, initializing the superclass fields directly is considered bad style. Instead, these are initialized by calling a super constructor.
All options of the tool are implemented as fields. Options parsing doesn't throw exceptions anymore. Invocations with too many arguments are caught.
Moved declarations closer to their usage. Limited scope for local variables. Removed dead code (fontFile == null). Added missing space between "and" and "encoding" in printUsage. Changed linebreaks in printUsage to only appear between whole words. Converted newline characters to native linebreaks (\n -> %n).
Closing a stream is only possible when the stream has been assigned to a variable. This makes the code a little shorter.
Previously, Format13 accidentally used some constants from Format12. Additionally, having shorter names makes the core more readable.
This is an API change since the enum constants are not accessible anymore. They were not used by the sfntly code anyway, since the very purpose of this class is to provide an abstraction layer over these constants.
Contrary to C, the Java format strings don't know %i.
By separating the formatting from the data, the structure of the generated text becomes a little clearer.
When reading the specifications it is not apparent where the offset and length for the glyphs in this table come from. A little cross-reference helps answering this question.
This is shorter than the other variant and reduces the potential for typos. (There were none in this code, though.)
Several of the table formats use very similar descriptions, therefore the same code can be used to iterate over the characters of these tables.
Table.toString now always uses the same number of digits, so that the tables align nicely in Font.toString.
When the FontInputStream skips over some bytes, these bytes are not seen by the DigestInputStream. This happens for padding between the tables. Now the digest is computed on the whole file, making it easy to check the digest with the usual command line tools like sha1sum.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
Fixes part of #10.
The internal code says that the two arguments of a composite glyph should be interpreted as uint16, which positions the 1 of the 1/4 fraction 65536 units too far to the right. This commit makes all simple glyphs of the frac14 visible. The 4 is in the wrong position, which will be fixed in a follow-up commit. Fixes part of #10.
See https://docs.microsoft.com/en-us/typography/opentype/spec/glyf, section Composite Glyph Description. Fixes part of #10.
A LinkedList is not nearly as useful as a LinkedHashSet. Quite the contrary, calling LinkedList.get() takes linear time instead of constant time. There was no sign in the code that these list were structurally modified in the middle, which is the only use case for LinkedList.
# Conflicts: # README.md # java/src/com/google/typography/font/tools/conversion/eot/GlyfEncoder.java # java/src/com/google/typography/font/tools/conversion/eot/LzcompCompress.java # java/test/com/google/typography/font/tools/conversion/eot/GlyfEncoderTest.java
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
download