Why can I not use a system font that is recognized by ggplot2 in ggiraph?

I’m trying to create an interactive plot with ggiraph using my organization’s ggplot theme. The fonts specified there are as follows:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>font_light <- "Segoe UI Semilight"
</code>
<code>font_light <- "Segoe UI Semilight" </code>
font_light <- "Segoe UI Semilight"

The theme uses the fonts this way:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code># font_import() # did this once
loadfonts(device = "win") # do this every session
theme_org <- function() {
theme(
# Text Elements
plot.subtitle = element_text(
family = font_light,
size = 11,
hjust = 0,
margin = margin(b = 10)
)
)
</code>
<code># font_import() # did this once loadfonts(device = "win") # do this every session theme_org <- function() { theme( # Text Elements plot.subtitle = element_text( family = font_light, size = 11, hjust = 0, margin = margin(b = 10) ) ) </code>
# font_import() # did this once
loadfonts(device = "win") # do this every session

theme_org <- function() {
   theme(
      # Text Elements
      plot.subtitle = element_text(
        family = font_light,
        size = 11,
        hjust = 0,
        margin = margin(b = 10)
      )
   )

When I use this theme to produce a regular ggplot there is no issue. But when I use that ggplot object in a girafe() call I get the following error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Error in `girafe()`:
! Font family 'Segoe UI Semilight' has not been found on your system or is not registered.
ℹ You can use a google font with `gdtools::register_gfont()`.
ℹ You can use any font with `systemfonts::register_font()`.
</code>
<code>Error in `girafe()`: ! Font family 'Segoe UI Semilight' has not been found on your system or is not registered. ℹ You can use a google font with `gdtools::register_gfont()`. ℹ You can use any font with `systemfonts::register_font()`. </code>
Error in `girafe()`:
! Font family 'Segoe UI Semilight' has not been found on your system or is not registered.
ℹ You can use a google font with `gdtools::register_gfont()`.
ℹ You can use any font with `systemfonts::register_font()`.

Here’s what my Segoe system fonts look like:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>> systemfonts::system_fonts() %>% filter(grepl("Segoe", family))
# A tibble: 20 × 9
path index name family style weight width italic monospace
<chr> <int> <chr> <chr> <chr> <ord> <ord> <lgl> <lgl>
1 "C:\Windows\Fonts\segmdl2.ttf" 0 SegoeMDL2Assets Segoe MDL2 Assets Regular normal norm… FALSE FALSE
2 "C:\Windows\Fonts\segoepr.ttf" 0 SegoePrint Segoe Print Regular normal norm… FALSE FALSE
3 "C:\Windows\Fonts\segoeprb.ttf" 0 SegoePrint-Bold Segoe Print Bold bold norm… FALSE FALSE
4 "C:\Windows\Fonts\segoesc.ttf" 0 SegoeScript Segoe Script Regular normal norm… FALSE FALSE
5 "C:\Windows\Fonts\segoescb.ttf" 0 SegoeScript-Bold Segoe Script Bold bold norm… FALSE FALSE
6 "C:\Windows\Fonts\segoeui.ttf" 0 SegoeUI Segoe UI Regular normal norm… FALSE FALSE
7 "C:\Windows\Fonts\seguibl.ttf" 0 SegoeUIBlack Segoe UI Black heavy norm… FALSE FALSE
8 "C:\Windows\Fonts\seguibli.ttf" 0 SegoeUIBlack-Italic Segoe UI Black It… heavy norm… TRUE FALSE
9 "C:\Windows\Fonts\segoeuib.ttf" 0 SegoeUI-Bold Segoe UI Bold bold norm… FALSE FALSE
10 "C:\Windows\Fonts\segoeuiz.ttf" 0 SegoeUI-BoldItalic Segoe UI Bold Ita… bold norm… TRUE FALSE
11 "C:\Windows\Fonts\seguiemj.ttf" 0 SegoeUIEmoji Segoe UI Emoji Regular normal norm… FALSE FALSE
12 "C:\Windows\Fonts\seguihis.ttf" 0 SegoeUIHistoric Segoe UI Historic Regular normal norm… FALSE FALSE
13 "C:\Windows\Fonts\segoeuii.ttf" 0 SegoeUI-Italic Segoe UI Italic normal norm… TRUE FALSE
14 "C:\Windows\Fonts\segoeuil.ttf" 0 SegoeUI-Light Segoe UI Light light norm… FALSE FALSE
15 "C:\Windows\Fonts\seguili.ttf" 0 SegoeUI-LightItalic Segoe UI Light It… light norm… TRUE FALSE
16 "C:\Windows\Fonts\seguisb.ttf" 0 SegoeUI-Semibold Segoe UI Semibold semib… norm… FALSE FALSE
17 "C:\Windows\Fonts\seguisbi.ttf" 0 SegoeUI-SemiboldItalic Segoe UI Semibold… semib… norm… TRUE FALSE
18 "C:\Windows\Fonts\segoeuisl.ttf" 0 SegoeUI-Semilight Segoe UI Semilight NA norm… FALSE FALSE
19 "C:\Windows\Fonts\seguisli.ttf" 0 SegoeUI-SemilightItalic Segoe UI Semiligh… NA norm… TRUE FALSE
20 "C:\Windows\Fonts\seguisym.ttf" 0 SegoeUISymbol Segoe UI Symbol Regular normal norm… FALSE FALSE
</code>
<code>> systemfonts::system_fonts() %>% filter(grepl("Segoe", family)) # A tibble: 20 × 9 path index name family style weight width italic monospace <chr> <int> <chr> <chr> <chr> <ord> <ord> <lgl> <lgl> 1 "C:\Windows\Fonts\segmdl2.ttf" 0 SegoeMDL2Assets Segoe MDL2 Assets Regular normal norm… FALSE FALSE 2 "C:\Windows\Fonts\segoepr.ttf" 0 SegoePrint Segoe Print Regular normal norm… FALSE FALSE 3 "C:\Windows\Fonts\segoeprb.ttf" 0 SegoePrint-Bold Segoe Print Bold bold norm… FALSE FALSE 4 "C:\Windows\Fonts\segoesc.ttf" 0 SegoeScript Segoe Script Regular normal norm… FALSE FALSE 5 "C:\Windows\Fonts\segoescb.ttf" 0 SegoeScript-Bold Segoe Script Bold bold norm… FALSE FALSE 6 "C:\Windows\Fonts\segoeui.ttf" 0 SegoeUI Segoe UI Regular normal norm… FALSE FALSE 7 "C:\Windows\Fonts\seguibl.ttf" 0 SegoeUIBlack Segoe UI Black heavy norm… FALSE FALSE 8 "C:\Windows\Fonts\seguibli.ttf" 0 SegoeUIBlack-Italic Segoe UI Black It… heavy norm… TRUE FALSE 9 "C:\Windows\Fonts\segoeuib.ttf" 0 SegoeUI-Bold Segoe UI Bold bold norm… FALSE FALSE 10 "C:\Windows\Fonts\segoeuiz.ttf" 0 SegoeUI-BoldItalic Segoe UI Bold Ita… bold norm… TRUE FALSE 11 "C:\Windows\Fonts\seguiemj.ttf" 0 SegoeUIEmoji Segoe UI Emoji Regular normal norm… FALSE FALSE 12 "C:\Windows\Fonts\seguihis.ttf" 0 SegoeUIHistoric Segoe UI Historic Regular normal norm… FALSE FALSE 13 "C:\Windows\Fonts\segoeuii.ttf" 0 SegoeUI-Italic Segoe UI Italic normal norm… TRUE FALSE 14 "C:\Windows\Fonts\segoeuil.ttf" 0 SegoeUI-Light Segoe UI Light light norm… FALSE FALSE 15 "C:\Windows\Fonts\seguili.ttf" 0 SegoeUI-LightItalic Segoe UI Light It… light norm… TRUE FALSE 16 "C:\Windows\Fonts\seguisb.ttf" 0 SegoeUI-Semibold Segoe UI Semibold semib… norm… FALSE FALSE 17 "C:\Windows\Fonts\seguisbi.ttf" 0 SegoeUI-SemiboldItalic Segoe UI Semibold… semib… norm… TRUE FALSE 18 "C:\Windows\Fonts\segoeuisl.ttf" 0 SegoeUI-Semilight Segoe UI Semilight NA norm… FALSE FALSE 19 "C:\Windows\Fonts\seguisli.ttf" 0 SegoeUI-SemilightItalic Segoe UI Semiligh… NA norm… TRUE FALSE 20 "C:\Windows\Fonts\seguisym.ttf" 0 SegoeUISymbol Segoe UI Symbol Regular normal norm… FALSE FALSE </code>
> systemfonts::system_fonts() %>% filter(grepl("Segoe", family))
# A tibble: 20 × 9
   path                                index name                    family            style     weight width italic monospace
   <chr>                               <int> <chr>                   <chr>             <chr>     <ord>  <ord> <lgl>  <lgl>    
 1 "C:\Windows\Fonts\segmdl2.ttf"       0 SegoeMDL2Assets         Segoe MDL2 Assets Regular   normal norm… FALSE  FALSE    
 2 "C:\Windows\Fonts\segoepr.ttf"       0 SegoePrint              Segoe Print       Regular   normal norm… FALSE  FALSE    
 3 "C:\Windows\Fonts\segoeprb.ttf"      0 SegoePrint-Bold         Segoe Print       Bold      bold   norm… FALSE  FALSE    
 4 "C:\Windows\Fonts\segoesc.ttf"       0 SegoeScript             Segoe Script      Regular   normal norm… FALSE  FALSE    
 5 "C:\Windows\Fonts\segoescb.ttf"      0 SegoeScript-Bold        Segoe Script      Bold      bold   norm… FALSE  FALSE    
 6 "C:\Windows\Fonts\segoeui.ttf"       0 SegoeUI                 Segoe UI          Regular   normal norm… FALSE  FALSE    
 7 "C:\Windows\Fonts\seguibl.ttf"       0 SegoeUIBlack            Segoe UI          Black     heavy  norm… FALSE  FALSE    
 8 "C:\Windows\Fonts\seguibli.ttf"      0 SegoeUIBlack-Italic     Segoe UI          Black It… heavy  norm… TRUE   FALSE    
 9 "C:\Windows\Fonts\segoeuib.ttf"      0 SegoeUI-Bold            Segoe UI          Bold      bold   norm… FALSE  FALSE    
10 "C:\Windows\Fonts\segoeuiz.ttf"      0 SegoeUI-BoldItalic      Segoe UI          Bold Ita… bold   norm… TRUE   FALSE    
11 "C:\Windows\Fonts\seguiemj.ttf"      0 SegoeUIEmoji            Segoe UI Emoji    Regular   normal norm… FALSE  FALSE    
12 "C:\Windows\Fonts\seguihis.ttf"      0 SegoeUIHistoric         Segoe UI Historic Regular   normal norm… FALSE  FALSE    
13 "C:\Windows\Fonts\segoeuii.ttf"      0 SegoeUI-Italic          Segoe UI          Italic    normal norm… TRUE   FALSE    
14 "C:\Windows\Fonts\segoeuil.ttf"      0 SegoeUI-Light           Segoe UI          Light     light  norm… FALSE  FALSE    
15 "C:\Windows\Fonts\seguili.ttf"       0 SegoeUI-LightItalic     Segoe UI          Light It… light  norm… TRUE   FALSE    
16 "C:\Windows\Fonts\seguisb.ttf"       0 SegoeUI-Semibold        Segoe UI          Semibold  semib… norm… FALSE  FALSE    
17 "C:\Windows\Fonts\seguisbi.ttf"      0 SegoeUI-SemiboldItalic  Segoe UI          Semibold… semib… norm… TRUE   FALSE    
18 "C:\Windows\Fonts\segoeuisl.ttf"     0 SegoeUI-Semilight       Segoe UI          Semilight NA     norm… FALSE  FALSE    
19 "C:\Windows\Fonts\seguisli.ttf"      0 SegoeUI-SemilightItalic Segoe UI          Semiligh… NA     norm… TRUE   FALSE    
20 "C:\Windows\Fonts\seguisym.ttf"      0 SegoeUISymbol           Segoe UI Symbol   Regular   normal norm… FALSE  FALSE 

Any advice would be greatly appreciated!

I’ve read the discussion here but it doesn’t seem to apply to my situation. I’ve tried registering the font but it seems like ggplot and ggiraph are reading the family name differently.

New contributor

Seth Strumwasser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật