Skip to content

Commit

Permalink
merge master with slight conflicts fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
gfngfn committed Oct 24, 2023
2 parents d0a805f + 530ab47 commit 7fe53a5
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 52 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [0.0.10] - 2023-10-12
### Fixed
- Fix URLs of Latin Modern fonts for installation ([PR\#412](https://github.com/gfngfn/SATySFi/pull/412) by `caphosra`).
- Several fixes about decoding/encoding OpenType fonts ([PR\#415](https://github.com/gfngfn/SATySFi/pull/415)).
- Warn overriding of non-empty tabular cells instead of aborting ([PR\#416](https://github.com/gfngfn/SATySFi/pull/416)).

## [0.0.9] - 2023-05-26
### Fixed
- Emit a parsing error when a parameter sequence ends with an optional one ([PR\#365](https://github.com/gfngfn/SATySFi/pull/365) by `anko9801`).
Expand Down Expand Up @@ -147,8 +153,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/),
- Initial version of SATySFi


[Unreleased]: https://github.com/gfngfn/SATySFi/compare/v0.0.9...HEAD
[0.0.8]: https://github.com/gfngfn/SATySFi/compare/v0.0.8...v0.0.9
[Unreleased]: https://github.com/gfngfn/SATySFi/compare/v0.0.10...HEAD
[0.0.10]: https://github.com/gfngfn/SATySFi/compare/v0.0.9...v0.0.10
[0.0.9]: https://github.com/gfngfn/SATySFi/compare/v0.0.8...v0.0.9
[0.0.8]: https://github.com/gfngfn/SATySFi/compare/v0.0.7...v0.0.8
[0.0.7]: https://github.com/gfngfn/SATySFi/compare/v0.0.6...v0.0.7
[0.0.6]: https://github.com/gfngfn/SATySFi/compare/v0.0.5...v0.0.6
Expand Down
2 changes: 1 addition & 1 deletion README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* 株式会社ドワンゴ(2018年10月–2019年3月.アルバイトとして)
* [The SATySFi​book](https://booth.pm/ja/items/1127224)を購入頂いた,多くの匿名の支援者の方々

また,2023年5月現在も発展を続けています
また,2023年10月現在も発展を続けています

## Satyrographos を使ったインストール方法 (初心者向け)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This software was supported by:
* Dwango Co., Ltd. (October 2018 – March 2019; as a part-time job), and
* many anonymous supporters who bought [The SATySFi​book](https://booth.pm/ja/items/1127224),

and its development continues to this day (May 2023).
and its development continues to this day (Oct 2023).

## Install using Satyrographos (for non-devs)

Expand Down
4 changes: 2 additions & 2 deletions download-fonts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ download_file () {

# Latin Modern
NAME=lm2.004otf
download_file "$NAME.zip" "http://www.gust.org.pl/projects/e-foundry/latin-modern/download/lm2.004otf.zip"
download_file "$NAME.zip" "https://www.gust.org.pl/projects/e-foundry/latin-modern/download/lm2.004otf.zip"
unzip -o "$CACHE/$NAME.zip" "*.otf" -d lib-satysfi/dist/fonts/

# Latin Modern Math
NAME=latinmodern-math-1959
download_file "$NAME.zip" "http://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip"
download_file "$NAME.zip" "https://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip"
unzip -o "$CACHE/$NAME.zip" "*.otf" -d "$CACHE/"
cp "$CACHE"/latinmodern-math-1959/otf/latinmodern-math.otf lib-satysfi/dist/fonts/

Expand Down
4 changes: 2 additions & 2 deletions satysfi.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "satysfi"
version: "0.0.9"
version: "0.0.10"
maintainer: "Takashi Suwa"
authors: [
"Takashi Suwa"
Expand Down Expand Up @@ -30,7 +30,7 @@ depends: [
"dune" {build}
"menhir"
"ocamlfind" {build}
"otfed" {= "0.1.0"}
"otfed" {= "0.3.1"}
"ppx_deriving"
"re" {build}
"uutf"
Expand Down
16 changes: 2 additions & 14 deletions src/backend/fontFormat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1208,18 +1208,6 @@ let font_stretch_of_width_class = function
| V.Os2.WidthUltraExpanded -> UltraExpandedStretch


let font_weight_of_weight_class = function
| V.Os2.WeightThin -> 100
| V.Os2.WeightExtraLight -> 200
| V.Os2.WeightLight -> 300
| V.Os2.WeightNormal -> 400
| V.Os2.WeightMedium -> 500
| V.Os2.WeightSemiBold -> 600
| V.Os2.WeightBold -> 700
| V.Os2.WeightExtraBold -> 800
| V.Os2.WeightBlack -> 900


type font_descriptor = {
font_name : string;
font_family : string;
Expand Down Expand Up @@ -1336,7 +1324,7 @@ let get_cmap_subtable srcpath (d : D.source) : V.Cmap.subtable =
let res =
let open ResultMonad in
D.Cmap.get d >>= fun icmap ->
D.Cmap.get_subtables icmap >>= fun isubtbls ->
D.Cmap.get_subtables icmap >>= fun (isubtbls, _ivarsubtbls) ->
isubtbls |> List.fold_left (fun res isubtbl -> (* TODO: refactor here by using `mapM` *)
res >>= fun acc ->
let format = D.Cmap.get_format_number isubtbl in
Expand Down Expand Up @@ -1423,7 +1411,7 @@ let font_descriptor_of_decoder (dcdr : decoder) (font_name : string) =
font_name = font_name; (* Same as `Otfm.postscript_name dcdr` *)
font_family = ""; (* temporary; should be gotten from decoder *)
font_stretch = Some(font_stretch_of_width_class ios2.I.Os2.value.us_width_class);
font_weight = Some(font_weight_of_weight_class ios2.I.Os2.value.us_weight_class);
font_weight = Some(ios2.I.Os2.value.us_weight_class);
flags = None; (* temporary; should be gotten from decoder *)
font_bbox = bbox;
italic_angle = 0.; (* temporary; should be gotten from decoder; 'post.italicAngle' *)
Expand Down
54 changes: 24 additions & 30 deletions src/backend/tabular.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,18 @@ let determine_row_metrics (restprev : rest_row) (row : row) : rest_row * length
| ((Some((numrow, _len)) as rsome) :: rtail, cell :: ctail) ->
begin
match cell with
| NormalCell(_)
| MultiCell(_, _, _, _)
-> assert false (* temporary; maybe should just warn users *)

| EmptyCell ->
let (hgtmaxnew, dptminnew) =
if numrow < 1 then
assert false
else if numrow = 1 then
(hgtmax, dptmin) (* temporary; should consider 'len' *)
else
(hgtmax, dptmin)
in
aux (Alist.extend restacc rsome) hgtmaxnew dptminnew rtail ctail
end
| NormalCell(_) | MultiCell(_, _, _, _) -> Logging.warn_wide_row_cell_overrides_nonempty_cell ()
| EmptyCell -> ()
end;
let (hgtmaxnew, dptminnew) =
if numrow < 1 then
assert false
else if numrow = 1 then
(hgtmax, dptmin) (* temporary; should consider 'len' *)
else
(hgtmax, dptmin)
in
aux (Alist.extend restacc rsome) hgtmaxnew dptminnew rtail ctail
in
let (restacc, hgtmax, dptmin) = aux Alist.empty Length.zero Length.zero restprev row in
let rest =
Expand Down Expand Up @@ -119,21 +116,18 @@ let determine_column_width (restprev : rest_column) (col : column) : rest_column
| ((Some((numcol, widrest)) as rsome) :: rtail, cell :: ctail) ->
begin
match cell with
| NormalCell(_)
| MultiCell(_)
-> assert false (* temporary; maybe should just warn users *)

| EmptyCell ->
let widmaxnew =
if numcol < 1 then
assert false
else if numcol = 1 then
Length.max widrest widmax
else
widmax
in
aux (Alist.extend restacc rsome) widmaxnew rtail ctail
end
| NormalCell(_) | MultiCell(_) -> Logging.warn_wide_column_cell_overrides_nonempty_cell ()
| EmptyCell -> ()
end; (* TODO: detailed warning *)
let widmaxnew =
if numcol < 1 then
assert false
else if numcol = 1 then
Length.max widrest widmax
else
widmax
in
aux (Alist.extend restacc rsome) widmaxnew rtail ctail
in
let (restacc, widmax) = aux Alist.empty Length.zero restprev col in
let rest =
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/logging.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,11 @@ let warn_underfull_line (pageno : int) =
let warn_unreachable (pageno : int) =
Format.printf " [Warning] a line unable to be broken into a paragraph occurs on page %d\n"
pageno


let warn_wide_column_cell_overrides_nonempty_cell () =
Format.printf " [Warning] a non-empty cell was overridden by a cell that has more than one column span.\n"


let warn_wide_row_cell_overrides_nonempty_cell () =
Format.printf " [Warning] a non-empty cell was overridden by a cell that has more than one row span.\n"

0 comments on commit 7fe53a5

Please sign in to comment.