Skip to content

Commit

Permalink
fix about DefaultLangSys
Browse files Browse the repository at this point in the history
  • Loading branch information
gfngfn committed Feb 16, 2019
1 parent 90f4e5d commit dd181b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion satysfi.opam
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ depends: [
"dune" {build}
"menhir"
"ocamlfind" {build}
"otfm" {= "0.3.3+satysfi"}
"otfm" {= "0.3.4+satysfi"}
"ppx_deriving"
"re" {build}
"uutf"
Expand Down
27 changes: 21 additions & 6 deletions src/backend/fontFormat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,23 @@ let result_bind x f =
| Error(e) -> Error(e :> error)


let select_langsys gxxx_langsys script =
let open ResultMonad in
gxxx_langsys script >>= fun langsys_res ->
let langsys =
match langsys_res with
| (Some(langsys), _) -> langsys
| (None, langsys :: _) -> langsys
| (None, []) -> remains_to_be_implemented "no langsys"
(* temporary; should depend on the current language system *)
in
return langsys


let select_gpos_langsys = select_langsys Otfm.gpos_langsys
let select_gsub_langsys = select_langsys Otfm.gsub_langsys


let get_mark_table srcpath units_per_em d =
let script_tag = "latn" in (* temporary; should depend on the script *)
let mktbl = MarkTable.create () in
Expand All @@ -503,8 +520,7 @@ let get_mark_table srcpath units_per_em d =
return ()

| Some(script) ->
Otfm.gpos_langsys script >>= fun (langsys, _) ->
(* temporary; should depend on the current language system *)
select_gpos_langsys script >>= fun langsys ->
Otfm.gpos_feature langsys >>= fun (_, featurelst) ->
begin
match featurelst |> List.find_opt (fun gf -> Otfm.gpos_feature_tag gf = "mark") with
Expand Down Expand Up @@ -808,8 +824,7 @@ let get_ligature_table srcpath (submap : subset_map) (d : Otfm.decoder) : Ligatu

| Some(scriptlst) ->
pickup scriptlst (fun gs -> Otfm.gsub_script_tag gs = script_tag) `Missing_script >>= fun script ->
Otfm.gsub_langsys script >>= fun (langsys, _) ->
(* temporary; should depend on the current language system *)
select_gsub_langsys script >>= fun langsys ->
Otfm.gsub_feature langsys >>= fun (_, featurelst) ->
pickup featurelst (fun gf -> Otfm.gsub_feature_tag gf = "liga") `Missing_feature >>= fun feature ->
() |> Otfm.gsub feature ~lig:(fun () (gid, liginfolst) ->
Expand Down Expand Up @@ -939,7 +954,7 @@ let get_kerning_table srcpath (d : Otfm.decoder) =

| Some(scriptlst) ->
pickup scriptlst (fun gs -> Otfm.gpos_script_tag gs = script_tag) `Missing_script >>= fun script ->
Otfm.gpos_langsys script >>= fun (langsys, _) ->
select_gpos_langsys script >>= fun langsys ->
(* temporary; should depend on the current language system *)
Otfm.gpos_feature langsys >>= fun (_, featurelst) ->
pickup featurelst (fun gf -> Otfm.gpos_feature_tag gf = "kern") `Missing_feature >>= fun feature ->
Expand Down Expand Up @@ -2109,7 +2124,7 @@ let get_math_decoder (fontname : string) (abspath : abs_path) : (math_decoder *

| Some(scriptlst) ->
pickup scriptlst (fun gs -> Otfm.gsub_script_tag gs = "math") `Missing_script >>= fun script_math ->
Otfm.gsub_langsys script_math >>= fun (langsys, _) ->
select_gsub_langsys script_math >>= fun langsys ->
Otfm.gsub_feature langsys >>= fun (_, featurelst) ->
pickup featurelst (fun gf -> Otfm.gsub_feature_tag gf = "ssty") `Missing_feature
in
Expand Down

0 comments on commit dd181b2

Please sign in to comment.