Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

download #97

Open
wants to merge 138 commits into
base: main
Choose a base branch
from
Open

download #97

wants to merge 138 commits into from

Conversation

yangffan
Copy link

download

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.
@googlebot
Copy link

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. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

rillig and others added 14 commits July 11, 2018 18:48
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.
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.
Base automatically changed from master to main March 2, 2021 04:22
# 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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants