Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shape_string() fails on mono italic font #105

Closed
dmurdoch opened this issue Sep 29, 2023 · 1 comment
Closed

shape_string() fails on mono italic font #105

dmurdoch opened this issue Sep 29, 2023 · 1 comment

Comments

@dmurdoch
Copy link

I get a Freetype error when trying to shape italic mono text:

# This works:

textshaping::shape_text("abc", family = "mono", italic = TRUE)
#> $shape
#>   glyph index metric_id string_id  x_offset y_offset x_midpoint
#> 1     0    68         1         1  0.000000        0    3.59375
#> 2     1    69         1         1  7.203125        0    3.59375
#> 3     2    70         1         1 14.406250        0    3.59375
#> 
#> $metrics
#>   string    width   height left_bearing right_bearing top_bearing
#> 1    abc 21.60938 21.04688      0.96875     -0.140625       1.375
#>   bottom_bearing left_border top_border    pen_x pen_y
#> 1         2.8125           0   9.046875 21.60938     0

# This doesn't:

systemfonts::shape_string("abc", family = "mono", italic = TRUE)
#> Error: Failed to shape string (abc) with font file (/System/Library/Fonts/Courier.ttc) with freetype error 130

sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: x86_64-apple-darwin20 (64-bit)
#> Running under: macOS Monterey 12.7
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: America/Toronto
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] styler_1.10.2     digest_0.6.33     fastmap_1.1.1     xfun_0.40        
#>  [5] magrittr_2.0.3    glue_1.6.2        R.utils_2.12.2    knitr_1.44       
#>  [9] htmltools_0.5.6   rmarkdown_2.25    lifecycle_1.0.3   cli_3.6.1        
#> [13] R.methodsS3_1.8.2 vctrs_0.6.3       reprex_2.0.2      textshaping_0.3.6
#> [17] withr_2.5.0       systemfonts_1.0.4 compiler_4.3.1    R.oo_1.25.0      
#> [21] R.cache_0.16.0    purrr_1.0.2       rstudioapi_0.15.0 tools_4.3.1      
#> [25] evaluate_0.21     yaml_2.3.7        rlang_1.1.1       fs_1.6.3

Created on 2023-09-29 with reprex v2.0.2

@thomasp85
Copy link
Member

Thanks - 130 is a FreeType stack overflow error so this would suggest issues with either the font file or freetype... I'll try to see if I can reproduce the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants