Skip to content

Commit

Permalink
Adapt NOTICE
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Jun 6, 2024
1 parent 7283542 commit eb3c312
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 145 deletions.
197 changes: 60 additions & 137 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,138 +1,61 @@
Licenses for third party components used by this project can be found below.
ttf-parser
Code from ttf-parser was used/adapted for the following parts:
- Reader, Writer, LazyArray16 and LazyArray16Iter
- `name` table parsing.
- `hmtx` table parsing.
- Most of the `cff` parsing logic as well auxiliary structs and functions
such as `calc_subroutine_bias`, `SIDMetadata`, `CIDMetadata` `RealNumber`,
`Index`, `IndexSize`, `OffsetSize`, `FDSelect`, `ArgumentStack`, `Top Dict` and `FONT Dict`,
`DictionaryParser`.

The MIT license applies:

Copyright (c) 2018 Yevhenii Reizner

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

============================================================================================================

fonttools
Code from fonttools was used/adapted for the following parts:
- The `Decompiler` for charstrings.

The MIT license applies:
MIT License

Copyright (c) 2017 Just van Rossum

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================================================
The SIL Open Font License Version 1.1 applies to:

* Noto fonts in fonts/Noto*.ttf
Copyright 2018 The Noto Project Authors
(github.com/googlei18n/noto-fonts)

* Clicker Script fonts in fonts/ClickerScript*.ttf
Copyright (c) 2012 by Brian J. Bonislawsky and Jim Lyles DBA Astigmatic
(AOETI) (astigma@astigmatic.com), with Reserved Font Name "Mouse Memoirs"

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
================================================================================

================================================================================
The GUST Font License Version 1.0 applies to:

* Latin Modern fonts in fonts/LatinModern*.otf
(http://www.gust.org.pl/projects/e-foundry/lm-math)

* NewComputerModern fonts in fonts/NewCM*.otf

% This is version 1.0, dated 22 June 2009, of the GUST Font License.
% (GUST is the Polish TeX Users Group, http://www.gust.org.pl)
%
% For the most recent version of this license see
% http://www.gust.org.pl/fonts/licenses/GUST-FONT-LICENSE.txt
% or
% http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt
%
% This work may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
% license or (at your option) any later version.
%
% Please also observe the following clause:
% 1) it is requested, but not legally required, that derived works be
% distributed only after changing the names of the fonts comprising this
% work and given in an accompanying "manifest", and that the
% files comprising the Work, as listed in the manifest, also be given
% new names. Any exceptions to this request are also given in the
% manifest.
%
% We recommend the manifest be given in a separate file named
% MANIFEST-<fontid>.txt, where <fontid> is some unique identification
% of the font family. If a separate "readme" file accompanies the Work,
% we recommend a name of the form README-<fontid>.txt.
%
% The latest version of the LaTeX Project Public License is in
% http://www.latex-project.org/lppl.txt and version 1.3c or later
% is part of all distributions of LaTeX version 2006/05/20 or later.
================================================================================
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,3 @@ This crate forbids unsafe code and has zero dependencies.

## License
This crate is dual-licensed under the MIT and Apache 2.0 licenses.

## Acknowledgements
This crate reuses/builds upon two significant libraries:
- [ttf-parser](https://github.com/RazrFalcon/ttf-parser): Large parts of the code have been copied and adapted
from that crate, including but not limited to the reader/writer, parsing logic of certain tables as well as a large
part of the CFF parsing logic. This crate is dual-licensed under MIT/Apache.
- [fonttools](https://github.com/fonttools/fonttools): The logic for decompiling charstrings has been adapted from
that library. It is licensed under the MIT license.
1 change: 1 addition & 0 deletions src/cff/argstack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::Result;

const MAX_OPERANDS_LEN: usize = 48;

// Taken from ttf-parser.
/// TODO: Use array instead?
pub struct ArgumentsStack {
pub data: Vec<Number>,
Expand Down
1 change: 1 addition & 0 deletions src/cff/charstring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::fmt::{Debug, Formatter};

pub type CharString<'a> = &'a [u8];

// Adapted from fonttools.
/// A charstring decompiler.
pub struct Decompiler<'a> {
gsubr_handler: SubroutineHandler<'a>,
Expand Down
2 changes: 2 additions & 0 deletions src/cff/cid_font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use crate::Error::{MalformedFont, SubsetError};
use crate::GlyphRemapper;
use crate::Result;

// The parsing logic was taken from ttf-parser.

/// Parse CID metadata from a font.
pub fn parse_cid_metadata<'a>(
data: &'a [u8],
Expand Down
2 changes: 2 additions & 0 deletions src/cff/dict/font_dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::Error::SubsetError;
use crate::Result;
use std::array;

// The parsing logic was adapted from ttf-parser.

/// A font DICT.
#[derive(Default, Clone, Debug)]
pub struct FontDict<'a> {
Expand Down
2 changes: 2 additions & 0 deletions src/cff/dict/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ pub(crate) mod font_dict;
pub(crate) mod private_dict;
pub(crate) mod top_dict;

// The `DictionaryParser` was taken from ttf-parser.

use crate::cff::number::{Number, StringId};
use crate::cff::operator::{Operator, TWO_BYTE_OPERATOR_MARK};
use crate::read::Reader;
Expand Down
2 changes: 2 additions & 0 deletions src/cff/dict/private_dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use crate::Error::{MalformedFont, SubsetError};
use crate::Result;
use std::array;

// The parsing logic was adapted from ttf-parser.

/// Parse the subroutine offset from a private dict.
pub fn parse_subr_offset(data: &[u8]) -> Option<usize> {
let mut operands_buffer: [Number; 48] = array::from_fn(|_| Number::zero());
Expand Down
2 changes: 2 additions & 0 deletions src/cff/dict/top_dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use crate::Result;
use std::array;
use std::ops::Range;

// The parsing logic was adapted from ttf-parser.

#[derive(Default, Debug, Clone)]
pub struct TopDictData {
pub charset: Option<usize>,
Expand Down
2 changes: 2 additions & 0 deletions src/cff/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use crate::write::{Writeable, Writer};
use crate::Error::OverflowError;
use crate::Result;

// Taken from ttf-parser.

pub trait IndexSize: for<'a> Readable<'a> {
fn to_u32(self) -> u32;
}
Expand Down
1 change: 1 addition & 0 deletions src/cff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ fn get_sid_remapper<'a>(
Some(sid_remapper)
}

// The parsing logic was taken from ttf-parser.
impl<'a> Table<'a> {
pub fn parse(ctx: &mut Context<'a>) -> Result<Self> {
let cff = ctx.expect_table(Tag::CFF).ok_or(MalformedFont)?;
Expand Down
1 change: 1 addition & 0 deletions src/cff/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl Writeable for FixedNumber {
}

impl RealNumber {
// The parsing logic was taken from ttf-parser.
pub fn parse(r: &mut Reader) -> Option<RealNumber> {
let mut data = [0u8; FLOAT_STACK_LEN];
let mut idx = 0;
Expand Down
1 change: 1 addition & 0 deletions src/cff/sid_font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct SIDMetadata<'a> {
pub private_dict_data: &'a [u8],
}

// The parsing logic was taken from ttf-parser.
pub fn parse_sid_metadata<'a>(data: &'a [u8], top_dict: &TopDictData) -> SIDMetadata<'a> {
top_dict
.private
Expand Down
2 changes: 2 additions & 0 deletions src/hmtx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//! the number of glyphs that contain both, advance width and
//! left side bearing metrics.

// The parsing logic was taken from ttf-parser.

use super::*;
use crate::Error::OverflowError;

Expand Down
1 change: 1 addition & 0 deletions src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub struct Table<'a> {
}

impl<'a> Table<'a> {
// The parsing logic was adapted from ttf-parser.
pub fn parse(data: &'a [u8]) -> Option<Self> {
let mut r = Reader::new(data);

Expand Down

0 comments on commit eb3c312

Please sign in to comment.