1
- use std:: collections:: HashMap ;
1
+ use std:: { collections:: HashMap , fs , time :: UNIX_EPOCH } ;
2
2
3
3
use actix_web:: { get, web, Responder } ;
4
4
use figma_agent:: { PatternHelpers , CONFIG , FC , FONT_CACHE } ;
@@ -40,7 +40,8 @@ pub async fn font_files() -> impl Responder {
40
40
font_cache. borrow_mut ( ) . write ( ) ;
41
41
42
42
web:: Json ( payload:: FontFilesResult {
43
- version : 20 ,
43
+ version : 22 ,
44
+ package : "116.10.8" . to_owned ( ) , // latest version as of 2023-06-22
44
45
font_files,
45
46
} )
46
47
}
@@ -53,6 +54,14 @@ fn get_font_file(pattern: &Pattern) -> Option<payload::FontFile> {
53
54
path : path. to_owned ( ) ,
54
55
index,
55
56
57
+ user_installed : true ,
58
+ modified_at : fs:: metadata ( path)
59
+ . and_then ( |metadata| metadata. modified ( ) )
60
+ . ok ( )
61
+ . and_then ( |modified_time| modified_time. duration_since ( UNIX_EPOCH ) . ok ( ) )
62
+ . map ( |duration| duration. as_secs ( ) )
63
+ . unwrap_or ( 0 ) ,
64
+
56
65
postscript : pattern. postscript_name ( ) . unwrap_or ( "" ) . to_owned ( ) ,
57
66
family : pattern. family ( ) . unwrap_or ( "" ) . to_owned ( ) ,
58
67
style : pattern. style ( ) . unwrap_or ( "" ) . to_owned ( ) ,
@@ -61,7 +70,7 @@ fn get_font_file(pattern: &Pattern) -> Option<payload::FontFile> {
61
70
. slant ( )
62
71
. map ( |slant| slant != FC_SLANT_ROMAN )
63
72
. unwrap_or ( false ) ,
64
- width : pattern. os_width_class ( ) . unwrap_or ( 5 ) ,
73
+ stretch : pattern. os_width_class ( ) . unwrap_or ( 5 ) ,
65
74
66
75
is_variable : pattern. is_variable ( ) . unwrap_or ( false ) ,
67
76
variation_axes : None ,
0 commit comments