diff --git a/index.html b/index.html index d575bf8..00310be 100644 --- a/index.html +++ b/index.html @@ -121,7 +121,7 @@

Note that "Noto Sans JP" above (and "Iosevka SS08" below) is the font installed on my local machine, so the same code might not run on your environment. You can use dump_fontdb() to see the available combination of font family (e.g. "Arial"), weight (e.g. "bold"), and style (e.g. "italic").

 dump_fontdb()
-#> # A tibble: 448 × 5
+#> # A tibble: 449 × 5
 #>    source                                  index family        weight style 
 #>    <chr>                                   <int> <chr>         <chr>  <chr> 
 #>  1 "C:\\WINDOWS\\Fonts\\arial.ttf"             0 Arial         normal normal
@@ -134,7 +134,7 @@ 

#> 8 "C:\\WINDOWS\\Fonts\\BIZ-UDGothicB.ttc" 1 BIZ UDPGothic bold normal #> 9 "C:\\WINDOWS\\Fonts\\BIZ-UDGothicR.ttc" 0 BIZ UDGothic normal normal #> 10 "C:\\WINDOWS\\Fonts\\BIZ-UDGothicR.ttc" 1 BIZ UDPGothic normal normal -#> # ℹ 438 more rows

+#> # ℹ 439 more rows

You can also specify the font file directly. Pomicons is a font available on gabrielelana/pomicons, licensed under SIL OFL 1.1.

 pomicons_file <- here::here("fonts", "Pomicons.ttf")
@@ -249,8 +249,8 @@ 

Dev status

  • R-CMD-check
  • Lifecycle: experimental
  • -
  • CRAN status
  • -
  • string2path status badge
  • +
  • CRAN status
  • +
  • string2path status badge
diff --git a/pkgdown.yml b/pkgdown.yml index 06583cb..f4967d2 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,4 +2,4 @@ pandoc: 3.1.11 pkgdown: 2.1.1 pkgdown_sha: ~ articles: {} -last_built: 2024-10-31T02:14Z +last_built: 2024-10-31T11:01Z diff --git a/search.json b/search.json index 2222445..967f9b8 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2020 Hiroaki Yutani Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Hiroaki Yutani. Author, maintainer. authors dependency Rust crates. Contributor. see inst/AUTHORS file details","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Yutani H (2024). string2path: Rendering Font 'data.frame'. R package version 0.1.8.9000, https://github.com/yutannihilation/string2path, https://yutannihilation.github.io/string2path/.","code":"@Manual{, title = {string2path: Rendering Font into 'data.frame'}, author = {Hiroaki Yutani}, year = {2024}, note = {R package version 0.1.8.9000, https://github.com/yutannihilation/string2path}, url = {https://yutannihilation.github.io/string2path/}, }"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"The authors of the dependency Rust crates:"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"arrayvec (version 0.7.6):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"bluss"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"autocfg (version 1.4.0):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"Josh Stone"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"cc (version 1.1.31):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"Alex Crichton"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"core_maths (version 0.1.0):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"Robert Bastian string2path()","what":"dump_fontdb()","title":"Rendering Font into data.frame","text":"Note \"Noto Sans JP\" (\"Iosevka SS08\" ) font installed local machine, code might run environment. can use dump_fontdb() see available combination font family (e.g. \"Arial\"), weight (e.g. \"bold\"), style (e.g. \"italic\"). can also specify font file directly. Pomicons font available gabrielelana/pomicons, licensed SIL OFL 1.1.","code":"dump_fontdb() #> # A tibble: 448 × 5 #> source index family weight style #> #> 1 \"C:\\\\WINDOWS\\\\Fonts\\\\arial.ttf\" 0 Arial normal normal #> 2 \"C:\\\\WINDOWS\\\\Fonts\\\\arialbd.ttf\" 0 Arial bold normal #> 3 \"C:\\\\WINDOWS\\\\Fonts\\\\arialbi.ttf\" 0 Arial bold italic #> 4 \"C:\\\\WINDOWS\\\\Fonts\\\\ariali.ttf\" 0 Arial normal italic #> 5 \"C:\\\\WINDOWS\\\\Fonts\\\\ariblk.ttf\" 0 Arial black normal #> 6 \"C:\\\\WINDOWS\\\\Fonts\\\\bahnschrift.ttf\" 0 Bahnschrift normal normal #> 7 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicB.ttc\" 0 BIZ UDGothic bold normal #> 8 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicB.ttc\" 1 BIZ UDPGothic bold normal #> 9 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicR.ttc\" 0 BIZ UDGothic normal normal #> 10 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicR.ttc\" 1 BIZ UDPGothic normal normal #> # ℹ 438 more rows pomicons_file <- here::here(\"fonts\", \"Pomicons.ttf\") if (!file.exists(pomicons_file)) { dir.create(dirname(pomicons_file)) curl::curl_download( \"https://github.com/gabrielelana/pomicons/blob/master/fonts/Pomicons.ttf?raw=true\", destfile = pomicons_file ) } d_tmp <- string2path(\"\\uE007\", pomicons_file) ggplot(d_tmp) + geom_path(aes(x, y, group = path_id), linewidth = 5, colour = \"#26d1a9\") + theme_minimal() + coord_equal()"},{"path":"/index.html","id":"string2fill","dir":"","previous_headings":"Example","what":"string2fill()","title":"Rendering Font into data.frame","text":"","code":"d <- string2fill(\"abc\", \"Iosevka SS08\", font_weight = \"bold\", font_style = \"italic\") ggplot(d) + geom_polygon(aes(x, y, group = triangle_id, fill = factor(triangle_id %% 7)), colour = \"grey\", linewidth = 0.1) + theme_minimal() + coord_equal() + theme(legend.position = \"none\") + scale_fill_viridis_d(option = \"H\")"},{"path":"/index.html","id":"string2stroke","dir":"","previous_headings":"Example","what":"string2stroke()","title":"Rendering Font into data.frame","text":"","code":"for (w in 1:9 * 0.01) { d <- string2stroke(\"abc\",\"Iosevka SS08\", font_weight = \"bold\", font_style = \"italic\", line_width = w) p <- ggplot(d) + geom_polygon(aes(x, y, group = triangle_id, fill = factor(triangle_id %% 2)), colour = \"grey\", linewidth = 0.1) + theme_minimal() + coord_equal() + theme(legend.position = \"none\") + scale_fill_manual(values = c(\"purple\", \"pink\")) plot(p) }"},{"path":"/index.html","id":"tolerance","dir":"","previous_headings":"","what":"tolerance","title":"Rendering Font into data.frame","text":"tolerance controls resolution tessellation. can reduce tolerance get higher resolutions. cases, 1e-5 ~ 1e-6 enough. details, please refer lyon’s official document.","code":"for (tolerance in c(1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7)) { d <- string2fill(\"abc\", \"Iosevka SS08\", font_weight = \"bold\", font_style = \"italic\", tolerance = tolerance) p <- ggplot(d) + geom_polygon(aes(x, y, group = triangle_id), fill = \"transparent\", colour = \"black\", linewidth = 0.5) + theme_minimal() + coord_equal() + ggtitle(paste0(\"tolerance: \", tolerance)) plot(p) }"},{"path":"/reference/dump_fontdb.html","id":null,"dir":"Reference","previous_headings":"","what":"Dump the Font Database — dump_fontdb","title":"Dump the Font Database — dump_fontdb","text":"debugging purposes, extract font faces font database 'string2path' uses internally.","code":""},{"path":"/reference/dump_fontdb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dump the Font Database — dump_fontdb","text":"","code":"dump_fontdb()"},{"path":"/reference/dump_fontdb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Dump the Font Database — dump_fontdb","text":"tibble() containing columns: source source file font face. index index font face within source. family font family face. weight weight face. style style face.","code":""},{"path":"/reference/string2path.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a String to Paths — string2path","title":"Convert a String to Paths — string2path","text":"string2path() converts text paths width-less outlines glyph. string2stroke() converts text paths outlines, specified line width, glyph. string2fill() converts text paths filled polygon glyph.","code":""},{"path":"/reference/string2path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a String to Paths — string2path","text":"","code":"string2path( text, font, font_weight = c(\"normal\", \"thin\", \"extra_thin\", \"light\", \"medium\", \"semibold\", \"bold\", \"extra_bold\", \"black\"), font_style = c(\"normal\", \"italic\", \"oblique\"), tolerance = 5e-05 ) string2stroke( text, font, font_weight = c(\"normal\", \"thin\", \"extra_thin\", \"light\", \"medium\", \"semibold\", \"bold\", \"extra_bold\", \"black\"), font_style = c(\"normal\", \"italic\", \"oblique\"), tolerance = 5e-05, line_width = 0.03 ) string2fill( text, font, font_weight = c(\"normal\", \"thin\", \"extra_thin\", \"light\", \"medium\", \"semibold\", \"bold\", \"extra_bold\", \"black\"), font_style = c(\"normal\", \"italic\", \"oblique\"), tolerance = 5e-05 )"},{"path":"/reference/string2path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a String to Paths — string2path","text":"text text convert paths. font font family (e.g. \"Arial\") path font file (e.g. \"path//font.ttf\"). font_weight font weight. font_style font style. tolerance Maximum distance allowed curve approximation. details, please refer documentation underlying Rust library. line_width Line width strokes.","code":""},{"path":"/reference/string2path.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a String to Paths — string2path","text":"tibble() containing columns: x x position point path, scaled x / line height. left side first glyph x = 0. y Y position point path, scaled y / line height. baseline first line y = 0. glyph_id IDs distinguish glyphs. path_id IDs distinguish groups paths. triangle_id IDs distinguish triangles. string2path() contain column.","code":""},{"path":"/reference/string2path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a String to Paths — string2path","text":"","code":"available_fonts <- dump_fontdb() if (nrow(available_fonts) > 0) { family <- available_fonts$family[1] weight <- available_fonts$weight[1] style <- available_fonts$style[1] # Not all fonts can handle \"TEXT\" glyph. Stop here if it's the case. skip <- inherits(try(string2path(\"TEXT\", family, weight, style)), \"try-error\") if (!skip) { # string2path() converts a text to paths d_path <- string2path(\"TEXT\", family, weight, style) if (nrow(d_path) > 0) { plot(d_path$x, d_path$y) for (p in split(d_path, d_path$path_id)) { lines(p$x, p$y) } } # string2stroke() converts a text to strokes d_stroke <- string2stroke(\"TEXT\", family, weight, style) if (nrow(d_stroke) > 0) { plot(d_stroke$x, d_stroke$y) # The stroke is split into triangles, which can be distinguished by `triangle_id` set.seed(2) for (p in split(d_stroke, d_stroke$triangle_id)) { polygon(p$x, p$y, col = rgb(runif(1), runif(1), runif(1), 0.8)) } } # string2fill() converts a text to filled polygons d_fill <- string2fill(\"TEXT\", family, weight, style) if (nrow(d_fill) > 0) { plot(d_fill$x, d_fill$y) # The polygon is split into triangles, which can be distinguished by `triangle_id` set.seed(2) for (p in split(d_fill, d_fill$triangle_id)) { polygon(p$x, p$y, col = rgb(runif(1), runif(1), runif(1), 0.8)) } } } }"},{"path":"/news/index.html","id":"string2path-development-version","dir":"Changelog","previous_headings":"","what":"string2path (development version)","title":"string2path (development version)","text":"Partially support COLRv1 emoji fonts. COLRv1 emoji font color emoji, color emoji COLRv1 format. example, Noto Color Emoji several variants, seems primary one CBDT/CBLC format. clip layer composition information just discarded. can useful, ’s easy use information R. Fix string2fill() string2stroke(); second argument path file, unintentionally worked string2path(). string2path() now generates outline string2fill() string2stroke() (#69). path_id glyph_id now 1-origin. result string2fill() string2stroke() now don’t contain path_id column. found calculation path_id never correct, ’s probably better remove avoid confusion.","code":""},{"path":"/news/index.html","id":"string2path-018","dir":"Changelog","previous_headings":"","what":"string2path 0.1.8","title":"string2path 0.1.8","text":"CRAN release: 2024-08-24 maintenance release comply CRAN repository policy.","code":""},{"path":"/news/index.html","id":"string2path-017","dir":"Changelog","previous_headings":"","what":"string2path 0.1.7","title":"string2path 0.1.7","text":"CRAN release: 2024-05-31 maintenance release fix build error ARM Linux.","code":""},{"path":"/news/index.html","id":"string2path-016","dir":"Changelog","previous_headings":"","what":"string2path 0.1.6","title":"string2path 0.1.6","text":"CRAN release: 2023-12-17 maintenance release update dependency Rust crates.","code":""},{"path":"/news/index.html","id":"string2path-015","dir":"Changelog","previous_headings":"","what":"string2path 0.1.5","title":"string2path 0.1.5","text":"CRAN release: 2023-07-11 maintenance release fix misassumption R installation without shared libraries.","code":""},{"path":"/news/index.html","id":"string2path-014","dir":"Changelog","previous_headings":"","what":"string2path 0.1.4","title":"string2path 0.1.4","text":"CRAN release: 2023-07-09 Fix build failure Rust >= 1.70 Windows","code":""},{"path":"/news/index.html","id":"string2path-013","dir":"Changelog","previous_headings":"","what":"string2path 0.1.3","title":"string2path 0.1.3","text":"CRAN release: 2023-01-23 maintenance release fix misassumption Rust installation Windows.","code":""},{"path":"/news/index.html","id":"string2path-012","dir":"Changelog","previous_headings":"","what":"string2path 0.1.2","title":"string2path 0.1.2","text":"CRAN release: 2022-12-17 maintenance release disable downloading pre-compiled binaries order comply CRAN Repository Policy.","code":""},{"path":"/news/index.html","id":"string2path-011","dir":"Changelog","previous_headings":"","what":"string2path 0.1.1","title":"string2path 0.1.1","text":"CRAN release: 2022-08-06 maintenance release fix mistakes pointed CRAN maintainer.","code":""},{"path":"/news/index.html","id":"breaking-changes-0-1-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"string2path 0.1.1","text":"Drop support R < 4.2.","code":""},{"path":"/news/index.html","id":"string2path-010","dir":"Changelog","previous_headings":"","what":"string2path 0.1.0","title":"string2path 0.1.0","text":"CRAN release: 2022-07-17","code":""},{"path":"/news/index.html","id":"breaking-changes-0-1-0","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"string2path 0.1.0","text":"Drop support R < 4.1. Now functions accept font family name. support TTC file properly, contains one fonts. new function dump_fontdb() useful check actual family name (weight style) specify. also accept file path, existing code work, except specifying tolerance without named argument. minimum supported Rust version bumped 1.56.0 2021 edition.","code":""},{"path":"/news/index.html","id":"string2path-004","dir":"Changelog","previous_headings":"","what":"string2path 0.0.4","title":"string2path 0.0.4","text":"CRAN release: 2021-11-22 maintenance release make installation work even slow internet connection.","code":""},{"path":"/news/index.html","id":"string2path-003","dir":"Changelog","previous_headings":"","what":"string2path 0.0.3","title":"string2path 0.0.3","text":"CRAN release: 2021-09-26 maintenance release improve configure scripts detect Rust installations correctly. new features added.","code":""},{"path":"/news/index.html","id":"string2path-002","dir":"Changelog","previous_headings":"","what":"string2path 0.0.2","title":"string2path 0.0.2","text":"CRAN release: 2021-08-09 Fix CRAN build errors. Support “open path”-type glyphs (#7).","code":""},{"path":"/news/index.html","id":"string2path-001","dir":"Changelog","previous_headings":"","what":"string2path 0.0.1","title":"string2path 0.0.1","text":"CRAN release: 2021-08-04 Added NEWS.md file track changes package.","code":""}] +[{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2020 Hiroaki Yutani Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Hiroaki Yutani. Author, maintainer. authors dependency Rust crates. Contributor. see inst/AUTHORS file details","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Yutani H (2024). string2path: Rendering Font 'data.frame'. R package version 0.1.8.9000, https://github.com/yutannihilation/string2path, https://yutannihilation.github.io/string2path/.","code":"@Manual{, title = {string2path: Rendering Font into 'data.frame'}, author = {Hiroaki Yutani}, year = {2024}, note = {R package version 0.1.8.9000, https://github.com/yutannihilation/string2path}, url = {https://yutannihilation.github.io/string2path/}, }"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"The authors of the dependency Rust crates:"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"arrayvec (version 0.7.6):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"bluss"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"autocfg (version 1.4.0):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"Josh Stone"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"cc (version 1.1.31):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"Alex Crichton"},{"path":[]},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"core_maths (version 0.1.0):"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Additional details","title":"Authors and Citation","text":"","code":"Robert Bastian string2path()","what":"dump_fontdb()","title":"Rendering Font into data.frame","text":"Note \"Noto Sans JP\" (\"Iosevka SS08\" ) font installed local machine, code might run environment. can use dump_fontdb() see available combination font family (e.g. \"Arial\"), weight (e.g. \"bold\"), style (e.g. \"italic\"). can also specify font file directly. Pomicons font available gabrielelana/pomicons, licensed SIL OFL 1.1.","code":"dump_fontdb() #> # A tibble: 449 × 5 #> source index family weight style #> #> 1 \"C:\\\\WINDOWS\\\\Fonts\\\\arial.ttf\" 0 Arial normal normal #> 2 \"C:\\\\WINDOWS\\\\Fonts\\\\arialbd.ttf\" 0 Arial bold normal #> 3 \"C:\\\\WINDOWS\\\\Fonts\\\\arialbi.ttf\" 0 Arial bold italic #> 4 \"C:\\\\WINDOWS\\\\Fonts\\\\ariali.ttf\" 0 Arial normal italic #> 5 \"C:\\\\WINDOWS\\\\Fonts\\\\ariblk.ttf\" 0 Arial black normal #> 6 \"C:\\\\WINDOWS\\\\Fonts\\\\bahnschrift.ttf\" 0 Bahnschrift normal normal #> 7 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicB.ttc\" 0 BIZ UDGothic bold normal #> 8 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicB.ttc\" 1 BIZ UDPGothic bold normal #> 9 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicR.ttc\" 0 BIZ UDGothic normal normal #> 10 \"C:\\\\WINDOWS\\\\Fonts\\\\BIZ-UDGothicR.ttc\" 1 BIZ UDPGothic normal normal #> # ℹ 439 more rows pomicons_file <- here::here(\"fonts\", \"Pomicons.ttf\") if (!file.exists(pomicons_file)) { dir.create(dirname(pomicons_file)) curl::curl_download( \"https://github.com/gabrielelana/pomicons/blob/master/fonts/Pomicons.ttf?raw=true\", destfile = pomicons_file ) } d_tmp <- string2path(\"\\uE007\", pomicons_file) ggplot(d_tmp) + geom_path(aes(x, y, group = path_id), linewidth = 5, colour = \"#26d1a9\") + theme_minimal() + coord_equal()"},{"path":"/index.html","id":"string2fill","dir":"","previous_headings":"Example","what":"string2fill()","title":"Rendering Font into data.frame","text":"","code":"d <- string2fill(\"abc\", \"Iosevka SS08\", font_weight = \"bold\", font_style = \"italic\") ggplot(d) + geom_polygon(aes(x, y, group = triangle_id, fill = factor(triangle_id %% 7)), colour = \"grey\", linewidth = 0.1) + theme_minimal() + coord_equal() + theme(legend.position = \"none\") + scale_fill_viridis_d(option = \"H\")"},{"path":"/index.html","id":"string2stroke","dir":"","previous_headings":"Example","what":"string2stroke()","title":"Rendering Font into data.frame","text":"","code":"for (w in 1:9 * 0.01) { d <- string2stroke(\"abc\",\"Iosevka SS08\", font_weight = \"bold\", font_style = \"italic\", line_width = w) p <- ggplot(d) + geom_polygon(aes(x, y, group = triangle_id, fill = factor(triangle_id %% 2)), colour = \"grey\", linewidth = 0.1) + theme_minimal() + coord_equal() + theme(legend.position = \"none\") + scale_fill_manual(values = c(\"purple\", \"pink\")) plot(p) }"},{"path":"/index.html","id":"tolerance","dir":"","previous_headings":"","what":"tolerance","title":"Rendering Font into data.frame","text":"tolerance controls resolution tessellation. can reduce tolerance get higher resolutions. cases, 1e-5 ~ 1e-6 enough. details, please refer lyon’s official document.","code":"for (tolerance in c(1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7)) { d <- string2fill(\"abc\", \"Iosevka SS08\", font_weight = \"bold\", font_style = \"italic\", tolerance = tolerance) p <- ggplot(d) + geom_polygon(aes(x, y, group = triangle_id), fill = \"transparent\", colour = \"black\", linewidth = 0.5) + theme_minimal() + coord_equal() + ggtitle(paste0(\"tolerance: \", tolerance)) plot(p) }"},{"path":"/reference/dump_fontdb.html","id":null,"dir":"Reference","previous_headings":"","what":"Dump the Font Database — dump_fontdb","title":"Dump the Font Database — dump_fontdb","text":"debugging purposes, extract font faces font database 'string2path' uses internally.","code":""},{"path":"/reference/dump_fontdb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dump the Font Database — dump_fontdb","text":"","code":"dump_fontdb()"},{"path":"/reference/dump_fontdb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Dump the Font Database — dump_fontdb","text":"tibble() containing columns: source source file font face. index index font face within source. family font family face. weight weight face. style style face.","code":""},{"path":"/reference/string2path.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a String to Paths — string2path","title":"Convert a String to Paths — string2path","text":"string2path() converts text paths width-less outlines glyph. string2stroke() converts text paths outlines, specified line width, glyph. string2fill() converts text paths filled polygon glyph.","code":""},{"path":"/reference/string2path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a String to Paths — string2path","text":"","code":"string2path( text, font, font_weight = c(\"normal\", \"thin\", \"extra_thin\", \"light\", \"medium\", \"semibold\", \"bold\", \"extra_bold\", \"black\"), font_style = c(\"normal\", \"italic\", \"oblique\"), tolerance = 5e-05 ) string2stroke( text, font, font_weight = c(\"normal\", \"thin\", \"extra_thin\", \"light\", \"medium\", \"semibold\", \"bold\", \"extra_bold\", \"black\"), font_style = c(\"normal\", \"italic\", \"oblique\"), tolerance = 5e-05, line_width = 0.03 ) string2fill( text, font, font_weight = c(\"normal\", \"thin\", \"extra_thin\", \"light\", \"medium\", \"semibold\", \"bold\", \"extra_bold\", \"black\"), font_style = c(\"normal\", \"italic\", \"oblique\"), tolerance = 5e-05 )"},{"path":"/reference/string2path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a String to Paths — string2path","text":"text text convert paths. font font family (e.g. \"Arial\") path font file (e.g. \"path//font.ttf\"). font_weight font weight. font_style font style. tolerance Maximum distance allowed curve approximation. details, please refer documentation underlying Rust library. line_width Line width strokes.","code":""},{"path":"/reference/string2path.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a String to Paths — string2path","text":"tibble() containing columns: x x position point path, scaled x / line height. left side first glyph x = 0. y Y position point path, scaled y / line height. baseline first line y = 0. glyph_id IDs distinguish glyphs. path_id IDs distinguish groups paths. triangle_id IDs distinguish triangles. string2path() contain column.","code":""},{"path":"/reference/string2path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a String to Paths — string2path","text":"","code":"available_fonts <- dump_fontdb() if (nrow(available_fonts) > 0) { family <- available_fonts$family[1] weight <- available_fonts$weight[1] style <- available_fonts$style[1] # Not all fonts can handle \"TEXT\" glyph. Stop here if it's the case. skip <- inherits(try(string2path(\"TEXT\", family, weight, style)), \"try-error\") if (!skip) { # string2path() converts a text to paths d_path <- string2path(\"TEXT\", family, weight, style) if (nrow(d_path) > 0) { plot(d_path$x, d_path$y) for (p in split(d_path, d_path$path_id)) { lines(p$x, p$y) } } # string2stroke() converts a text to strokes d_stroke <- string2stroke(\"TEXT\", family, weight, style) if (nrow(d_stroke) > 0) { plot(d_stroke$x, d_stroke$y) # The stroke is split into triangles, which can be distinguished by `triangle_id` set.seed(2) for (p in split(d_stroke, d_stroke$triangle_id)) { polygon(p$x, p$y, col = rgb(runif(1), runif(1), runif(1), 0.8)) } } # string2fill() converts a text to filled polygons d_fill <- string2fill(\"TEXT\", family, weight, style) if (nrow(d_fill) > 0) { plot(d_fill$x, d_fill$y) # The polygon is split into triangles, which can be distinguished by `triangle_id` set.seed(2) for (p in split(d_fill, d_fill$triangle_id)) { polygon(p$x, p$y, col = rgb(runif(1), runif(1), runif(1), 0.8)) } } } }"},{"path":"/news/index.html","id":"string2path-development-version","dir":"Changelog","previous_headings":"","what":"string2path (development version)","title":"string2path (development version)","text":"Partially support COLRv1 emoji fonts. COLRv1 emoji font color emoji, color emoji COLRv1 format. example, Noto Color Emoji several variants, seems primary one CBDT/CBLC format. clip layer composition information just discarded. can useful, ’s easy use information R. Fix string2fill() string2stroke(); second argument path file, unintentionally worked string2path(). string2path() now generates outline string2fill() string2stroke() (#69). path_id glyph_id now 1-origin. result string2fill() string2stroke() now don’t contain path_id column. found calculation path_id never correct, ’s probably better remove avoid confusion.","code":""},{"path":"/news/index.html","id":"string2path-018","dir":"Changelog","previous_headings":"","what":"string2path 0.1.8","title":"string2path 0.1.8","text":"CRAN release: 2024-08-24 maintenance release comply CRAN repository policy.","code":""},{"path":"/news/index.html","id":"string2path-017","dir":"Changelog","previous_headings":"","what":"string2path 0.1.7","title":"string2path 0.1.7","text":"CRAN release: 2024-05-31 maintenance release fix build error ARM Linux.","code":""},{"path":"/news/index.html","id":"string2path-016","dir":"Changelog","previous_headings":"","what":"string2path 0.1.6","title":"string2path 0.1.6","text":"CRAN release: 2023-12-17 maintenance release update dependency Rust crates.","code":""},{"path":"/news/index.html","id":"string2path-015","dir":"Changelog","previous_headings":"","what":"string2path 0.1.5","title":"string2path 0.1.5","text":"CRAN release: 2023-07-11 maintenance release fix misassumption R installation without shared libraries.","code":""},{"path":"/news/index.html","id":"string2path-014","dir":"Changelog","previous_headings":"","what":"string2path 0.1.4","title":"string2path 0.1.4","text":"CRAN release: 2023-07-09 Fix build failure Rust >= 1.70 Windows","code":""},{"path":"/news/index.html","id":"string2path-013","dir":"Changelog","previous_headings":"","what":"string2path 0.1.3","title":"string2path 0.1.3","text":"CRAN release: 2023-01-23 maintenance release fix misassumption Rust installation Windows.","code":""},{"path":"/news/index.html","id":"string2path-012","dir":"Changelog","previous_headings":"","what":"string2path 0.1.2","title":"string2path 0.1.2","text":"CRAN release: 2022-12-17 maintenance release disable downloading pre-compiled binaries order comply CRAN Repository Policy.","code":""},{"path":"/news/index.html","id":"string2path-011","dir":"Changelog","previous_headings":"","what":"string2path 0.1.1","title":"string2path 0.1.1","text":"CRAN release: 2022-08-06 maintenance release fix mistakes pointed CRAN maintainer.","code":""},{"path":"/news/index.html","id":"breaking-changes-0-1-1","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"string2path 0.1.1","text":"Drop support R < 4.2.","code":""},{"path":"/news/index.html","id":"string2path-010","dir":"Changelog","previous_headings":"","what":"string2path 0.1.0","title":"string2path 0.1.0","text":"CRAN release: 2022-07-17","code":""},{"path":"/news/index.html","id":"breaking-changes-0-1-0","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"string2path 0.1.0","text":"Drop support R < 4.1. Now functions accept font family name. support TTC file properly, contains one fonts. new function dump_fontdb() useful check actual family name (weight style) specify. also accept file path, existing code work, except specifying tolerance without named argument. minimum supported Rust version bumped 1.56.0 2021 edition.","code":""},{"path":"/news/index.html","id":"string2path-004","dir":"Changelog","previous_headings":"","what":"string2path 0.0.4","title":"string2path 0.0.4","text":"CRAN release: 2021-11-22 maintenance release make installation work even slow internet connection.","code":""},{"path":"/news/index.html","id":"string2path-003","dir":"Changelog","previous_headings":"","what":"string2path 0.0.3","title":"string2path 0.0.3","text":"CRAN release: 2021-09-26 maintenance release improve configure scripts detect Rust installations correctly. new features added.","code":""},{"path":"/news/index.html","id":"string2path-002","dir":"Changelog","previous_headings":"","what":"string2path 0.0.2","title":"string2path 0.0.2","text":"CRAN release: 2021-08-09 Fix CRAN build errors. Support “open path”-type glyphs (#7).","code":""},{"path":"/news/index.html","id":"string2path-001","dir":"Changelog","previous_headings":"","what":"string2path 0.0.1","title":"string2path 0.0.1","text":"CRAN release: 2021-08-04 Added NEWS.md file track changes package.","code":""}]