From 57cbcc6e864abd368bde93154b3580147936201c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Wed, 20 Oct 2021 07:57:30 +0300
Subject: [PATCH 1/1] Installing individual TTF files; generate fontpack.ini
po/en.po | 21 ++++
res/lang/de.bin | Bin 27098 -> 27722 bytes
res/lang/en.bin | Bin 24622 -> 25246 bytes
res/lang/eo.bin | Bin 23399 -> 24023 bytes
res/lang/es.bin | Bin 27482 -> 28106 bytes
res/lang/es_MX.bin | Bin 25450 -> 26074 bytes
res/lang/fi.bin | Bin 27396 -> 28020 bytes
res/lang/fr.bin | Bin 28304 -> 28928 bytes
res/lang/gl.bin | Bin 26760 -> 27384 bytes
res/lang/ia.bin | Bin 26423 -> 27047 bytes
res/lang/ie.bin | Bin 26628 -> 27252 bytes
res/lang/isv.bin | Bin 23326 -> 23950 bytes
res/lang/pl.bin | Bin 27699 -> 28323 bytes
res/lang/ru.bin | Bin 40071 -> 40695 bytes
res/lang/sk.bin | Bin 23659 -> 24283 bytes
res/lang/sr.bin | Bin 39943 -> 40567 bytes
res/lang/tok.bin | Bin 24873 -> 25497 bytes
res/lang/zh_Hans.bin | Bin 23375 -> 23999 bytes
res/lang/zh_Hant.bin | Bin 23516 -> 24140 bytes
src/app.c | 9 +-
src/fontpack.c | 223 ++++++++++++++++++++++++++++++++++------
src/fontpack.h | 34 +++---
src/gmdocument.c | 4 +-
src/gmrequest.c | 2 +-
src/ui/documentwidget.c | 82 ++++++++++++---
src/ui/text.c | 2 +-
26 files changed, 301 insertions(+), 76 deletions(-)
diff --git a/po/en.po b/po/en.po
index 0d5707b1..cc6ea545 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1921,6 +1921,9 @@ msgstr "Enable "%s""
msgid "fontpack.disable"
msgstr "Disable "%s""
+msgid "fontpack.export"
+msgstr "View fontpack.ini template"
#, c-format
msgid "fontpack.install"
msgstr "Install "%s""
@@ -1943,3 +1946,21 @@ msgstr "Do you really want to permanently delete\nthe fontpack "%s"?"
msgid "dlg.fontpack.delete"
msgstr "Delete Fontpack"
+msgid "fontpack.help"
+msgstr "Lagrange fontpacks are ZIP archives that contain a set of font files and associated configuration parameters. Once installed, the fonts can be used for document content and the UI. The active fonts are selected using Preferences > Fonts."
+msgid "fontpack.install.ttf"
+msgstr "Install TrueType Font"
+msgid "fontpack.open.fontsdir"
+msgstr "Open User Fonts Directory"
+msgid "fontpack.open.aboutfonts"
+msgstr "Show Installed Fonts"
+msgid "truetype.help"
+msgstr "Lagrange attempts to load all individual TrueType files that are copied to the user fonts directory."
+msgid "truetype.help.installed"
+msgstr "This font is installed in the user fonts directory."
diff --git a/res/lang/de.bin b/res/lang/de.bin
index cf3250a5e36e23650b3d4caed040d59e1c99bd78..e6b1bf856a8e4c04727cfe18f994168ddc546a4c 100644
GIT binary patch
delta 626
zcmZ{iJxT;Y5QW=A7+ZpYfefsHp(Y|M2ny~hn3X*>JB7X7O?Qny(H>$iA{co96H^oM
z7@olDnPt_$sD|cMeUJC%^L^v(W8(=&3wnqliMeFDhbDN5Xm2a_3_|nhP{^!bTXNBy
z;w+((OR4V6T$WPT&HdMjxtD#0#=V9dqBt}5So4g8g?o
UjybGEH9K$7j46{E}?Mn
z5HaDLgi@~H%v%EXS<pGE_w@8Y&S25Q4MCT6zX=KIV7oc_0bFK6!~;q!9uoQFpzK
z!E+`@Tek4K%zg&vi5g0z#0-aUqW*KWyc+FpulSWnW5$CQn52#-kCA%avKzfjLnL3}
zP3WW~md!;Q?qMZYMt{$&!|c_)u;ygWbQh+X(jbFlPGlvd$LF2>uY-jsOcYlAtpKHz
zBpP@C7f>^GPQ$ACj_VHHkH;bPzLrv!4UyH6Zk2pA!L&+6tqj=8{6-!{{UcTtm`TgI
QmxIprvwr=5Y`Mv=-x#atp#T5?
delta 26
icmX?ggYnj7#tn&vlRJ#$CSNpKzxlrL3$w{>*+&4gvJGzl
diff --git a/res/lang/en.bin b/res/lang/en.bin
index ffdd422666ea6833d6bfdbe03c0b73d4a9ad80ba..2ef67f5562e54f06f44daedf31c76aef22efbfb2 100644
GIT binary patch
delta 623
zcmZ{iF>YHi42I<?cgPZs8EPRXXqTXXfdCFrJ42R$(c|+YB1?kA7dMj+;XO<DqClr^
zU6Lbo&LMJuQtugVI%J|i{N(@RqrU&1JU&f+yiB+BHN`CEifIFF43f~@Sq=*P_$
z9J(F(WG--(F|6nyE`XWfdUmPRb$m|+q(cFx%a8*g6cUK-FaRxk6<}xpONoxR>d;he
z%d0-4a14+z<C=tWumygfI|
Vo|+H3dUP(}FuNAUv$2W8Jg(&HHFc)@oAa%bA6R
zR&=82h8Sb!LY_s_3sOZ6<lU&DU&)D_z0ghf3dqi)6?C{^yt
%v}QI2fkp0V@sMZ`
z?Ovz9mN8MVcpH1ExQhAG#SQGYA
G_2a<z&5H_66TxVffD33BY=S)swe)###KA&wx
z%|y-Y|NK$vg+ysb@DUZL_e!eadv1F4|1yrqhnv((xtLfJ=~RWI`0^f!Mj36bd29J8
Z>37)kH;azTAP237w!Yq9w(D-5{{nVA=+FQF
delta 26
icmbPtlyThw#tjd2C$sCzO%Bjszd6oekHO@diAMpRCkyxh
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 8ff3294eb7ee7a44873ce486f271e0bbfa73be69..89ec6fea72b32c3816df4fcbd1d88ae5026e1826 100644
GIT binary patch
delta 626
zcmZ{iJxT;Y5QW>5SY|88fPtwdA}k0B?i!etJvBRpz1>ZBjX%*IVlSYnkst^n7<vVd
z;5DqCSyl~<YG_{7_jqr<UN%18Hl7|w3%ZRVi8*JwfhKr~Xs;^v3_|nhP{^!bTXNAH
z<1C?{(OR4V6T!v!RHtqEnlea>0#=V9dqBt}5So4g8g?o`UjybGEH9K$7j46{E}?Mn
z5HaDLgi@~H#9IRPS<pGEcl7i?&S25QB|(>UzX=KIV7oc_0bFK6!~;q!9uoQFpzK
z!E+@o3
+~%zg%^i5g0z#0>jzr2ccYydRCWR{Tn&G2_7tOj1XayGXrm96A
hDg4`
z%g{+lESs}7+`vk%jQ*ZkhuN!pVa>^$=q^k%r9lRVoXAQ@chB?fz1@W<OcYlAtpKHz
zBpP@C7f>^GPQ$ACn(GeTkH;bPzLrv!4UyH6Zk2pA!L&+6tqj=8{6-!{UcTtm
TgI
RmxIprvwr=5Z255U@eQ51={*1d
delta 30
ocmV+(0O9}Fy8-960kEnllkX9lh
R2lNu_ovnVSoF_RKq#o6`@zyJUM
diff --git a/res/lang/es.bin b/res/lang/es.bin
index 810fe574d2246ad62189a9faeee570d2952fb9dd..701f047812164c72b04bdfccb2f42e93ce748021 100644
GIT binary patch
delta 631
zcmZ{iF-j~!5QfR7+M&JfedJ3_Dn=r5ER@sFe
g%c1nA@o9>!bqdml)z#9l=f*0@r
zFVOTI;KfE(&n)|%fl&?3|JV2P*S!DUc>CCRrKd8eGEy=CDR==!AnGYTd
*lnni~~
zX8qcdi{=!k3H_AT;tZGwu14oNZOe1YAT0`5U54xdA(KF8dIL1<RDiw)%sE(ID4{Oe
zhNoRZ;ou=+!WjvrT)~;Q1nje*b5!r?>VcfWqK9jOE~~!@3F=_G8TkQRW`Pv>WK_Xe
zCtA^TeT*S<CP!Pg@Vm@@3g?L$N~FXLzu-jk=W6+Pe|LMuuS6O%8nVDRbu@m6)a%R=
z4mX!O2al5w$yazCIw`efbJ2!7Sa}rGFE#5%dv!0YIhix{!X#4~WN^%htc3LN{Ce<m
zxDX|Z607fbKq;3JZ9RYssKq*`jnzEox<mIb=umxsn{qK5B5NXbm6Ei^w5mp<4A{#2
ck35R{TdeM2#x3Vw4m#J*t|d&<^1N)7tX
$SO5S3
delta 30
ocmV+(0O9}2+X33v0kHZplRq;DlPEJ6lWH@svv@SHH<RaV<J(jYG5`Po
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index 98234c642ac2bf3ca3351fb73a92f205ffd9f8f8..3013590a9f77400b0e4331795a2fd78b1a28a2da 100644
GIT binary patch
delta 626
zcmZ{iJx(Ms5QWW2D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CfyA>BXxKH46y
zM9oCas{i?;lnaT{4&VYRQ0J6X&9_{4=-x99$ord=OW6=v6X{feqxjMeiAEW0EA!Fv
aB<gqA@i)_!b1w(2`?kJ5U$#E|_4EcG5a>Ao
delta 30
ocmV+(0O9}i+5v>t0kEzylhraFlV&&$lPoi#vn({sH<Pz)z1vF-%>V!Z
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 313e4043d565a6c82941d8013aafd144d3579644..c4b482de6ef20df046f861a850662166d9bc21bd 100644
GIT binary patch
delta 623
zcmZ{iJx(M+426qJ8Xg_5
v|p4v0WVtCdDt38bANAT!nOX=`h$N>y%tqTvWga{_LF
zAmT72TmX)Mt9vvH0g+4Av)|L_x_jBWecgK4ua|TkLlSewbOmkj64Cyv*fR(%qC+9G
z>2~Cz`GfO>eoh;4222F!lT)p><4ejQ9ST@ohU@_$lR#*P0chE&0DS|PbFjQrho)#-
zp7#lbgNKL-7bKK&1t;DTu+M_dQS(z*kIoq^dbl9yv(C36K@)7hAU_(HT1<+3HmP8$
z6|HExA;y?FlcOD5{QJy)4yTD)N~De%4&k@v&(&(T-dpY0+dnFi)=b7AFiky8Zz2t%
z)p7ki3z2+<7onGeE1SPvxPrA@4TfcALvm0L!iJMM(OH;fN}~*ZaUv@r-8{Y5j|WRp
zGf}hZD}R)7AyL`^TtEftoRVtzlA9jg|BNH@;U?u$HbmA$I#u8(zO+W7QAXR!e6~D_
YW@E%&9vh@$U*C-t*
Hwt?n0ZAC`gU)c^nh
delta 26
icmZp8#5mzD;|5)m$swk4ljoYQ-@Mvvg~eo{f_DI#Eeogs
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index cee70fdeed1a76322136e26a5e8c939939b5b098..6b1ca49ab576c7120d4738198d2fff416defea8f 100644
GIT binary patch
delta 623
zcmZ{iu}&O842Fk_cc8%~iqPuPq$CYOItd9R?o!bCX1%*s=4M7SUf`+|9sRvUsz^zb
zhIasoHqSwcXZLiFB9%whZ~wnO&%@K+>&xEH$H|)R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~$)dgVs%3Utcd<UABMU0PH#G8UO$Q
delta 26
icmZ2}nQ{9$#trxMCbJsIP4+Wbzd6S6xY^`K8Ak!4zzjnG
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index b29318aedc72e412cad0ae933db40c11878d5700..6488b20fbf6b7032c49d7f2c08861394bd6869e6 100644
GIT binary patch
delta 626
zcmZ{iF-{~g5JgS8m!Qa20+WwM6{3~&
3xiF+%`R;jZp3;jt~d8kT4hZZH=?BH|VV
z9EAf=?j8+nKvXU3SG}+Q{
}#<9+M-bh4y>F(ffpOb^fmFA?os#hyWE5giJd&1*+4
znlo$@`j$50444S6rx!YH$M=$Iuxa4A}!hCV|il3(&Ar0s0y+=U{oMgt}-OZu^A7
z!9&D^3ld7Xf^%;P*k?iKsNU1lBRPXb54Qw;*8L_VsDten<VSFs1ybbmX$3Q#Xhq!(
zHb&2x9Btde?=$-rE)q4ANQoH^;Y9uCYV~WduPqBL>e<4y}&H>G<%FR=vFtALjHK
zE4&T8l*F>R?7{=A<;ocDnN663dJxu}%(?EuJX0EFaLkFUg!K6G>(B1NQWPc%tNyP5
zrIaKZcmNkrGj&eGs`;Ml9^IG6G4-LAQkD&o)sb$Md^EwdPDQPZ*vfoI9!32l))kmp
T$9a&0&dsxa{d{b--@bhUWrycr
delta 26
icmexzg|X!V;|6#A$$18HleZhJ-+a_i(R}jK%<}-HSqv@!
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 80bc275ff000d5b758b1d5ca6138a614460c4f32..0f783c31d714f6daddab59925d1321ec4b60567f 100644
GIT binary patch
delta 626
zcmZ{iO-ckY5QXDC1k0U_(w;!wh%g{1I3wb&Ojl1AW|ELp`?r}JxS73Y5ClQodoC;8
z!>9{a)r42|J>Kh=_l@Vzjn}8qfxW>VlJ8Pp$T3h+S`gfgU~!W6f1AmRvNaI7{ef
zv=(Q;L~uPm*J)e6qYTobfYoEj9uP7Kgr;ABhMfw~*MK<(%L^scMceSKODG&XL`m
zp_D5)^Ok^p7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bin
index 2a8554a52cc5a8c4909fed0abe9247d3acdc33f2..a0f75c6c191beec5dadc9fb141d093d44b6183b0 100644
GIT binary patch
delta 627
zcmZ{iy-w^f5QPomJ($~3p!77*pewCdek67&=mux98R4}pd%{n{78KA^!b2cYQSe-}
zjFZ&@1=U2>nfZ>+$;12l=g0c%<9I<gF(ff(OxMr^FA?o!#hyWE9vupq)oV*Gnla82
zWdan888u?k4|*jmaiy-v?yTp7_tY1Oah_l7ocIM0
xUt&cX6R33bsnJnIq)2M-Yw
z&Pgcc3XZ)cV4nq@qk3CU59ACMJzNlUS@)Zepboa1lOMok7D$m#M-@zTq7`-5+Za4&
za<pj+zsu}raFVE@LuxC3;)%BuAc73TmP2)N~AHP!3#
MN0Zw~z3%B{{5}nle1#XG
zlag3Ar){`~rCb^PJ+lh4SNFo2lR4I1m}W|Y4E8yZm5^@V4i0yY7NRgwSoOOClv0vt
z-~n7f&D1#!tL7NJ9OV3ht&I8N?A5UR!6#3^3ep-G8MHlU@P+zxfk
1SXN*rE$3bi
QI#<v7_4l#2`{#|dFCLueuK)l5
delta 31
pcmV+)0O0@ky#j~10<efolg&*BleSG4llV=qvj$HuPP6o#0|D{z4l)1$
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index f5172ada378c73021283242478b8eb830218c0a7..91bd13583487153e15b7d66f38dd8d92048fe172 100644
GIT binary patch
delta 626
zcmZ{iF-{{v5JlT3p@_f;jl>1m1R+^M0ttJAB`SJqJSE!Qt?n8Fkq_ZBkRwPyf^_4}
z_Xv9ls%I>-1VlAz{i^r%|NMIy{e2%jzKvIO7ef;Blj#<k;3cBHsn|0JEuupqvwdyJ
zMRSJpgnmw2aRy8Tza|$tZOco_AT05J%;Q7A(KF8
UPm%sQ`Tqm~*haQbJv{4bQuT
z!ofqtgbNZ%xq@?V3D{>r=cqo^(*rq!MGw~mUDo|3B&dV!7UTzTnFUhhvq=S0ooGef
z^)?32nH=rd!tXNsIb0-aD3KB~9K)&l&(->AyuZ8QS0as>3|?TGI-1@`>UHZs<JVb;
z<SV=mos6~xopENY~;%5@0o3wy}B3HoXolI!Yor7WN^ZXtb}y
ygJxBT8Y9$Vb#|P
zP)bRnfd_B_HB;v_teTfxcj!Jn4ypIGl(KAytd4Z6<f93uO)6?-z*gpe<d3L-#HIo>
UZ8`UH(7AoqukVkoAFh6X02=4%i~s-t
delta 30
mcmcb;m+|!u#tnNkCqLGbn=EC(Hz*i;btoxS;NU<aYq5u7z{
N
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 14ca2240ebd621c4af18c92e3067d4d33b66e5e0..55a289bd7b8ed5cbbbad3a0405dd73741ab32427 100644
GIT binary patch
delta 627
zcmZ{iF>V_%5Jedyjq4o1lPWF@9>H#m01^U7K%^Au#@t!$AQVZEvr=5C^a0%E6an1C
zfX`vTCvofHt{~es#y?!=6(FXH~)^FACCThn(pX#idoDLrYEFNJ96^a$pczCyzqr
z@Y<12<{Pduh7}#e1uzroXmB)jyF_5Iuvkv3^@QoA%WNq3(&Gx0fq!l<0V;gr;g+
zUiBG;V}OJi*CdpSg;{U}9Eza#)ST(*kzBxGfGdK&=zbeBG|}~I3M07A3aRqt#KJ-+
zI#G9njnQ)<PbaSO`@&%b^Gq#eQeuH~_^SSky*-|ue%|w~NNXme7g*$;7T1Xe-R+m@
z{W2yB7O!G2HL+s8cX11QxiW@(<`Cwf9)t~NGt*sI7RsXxE;*Bvn6K|1ryu7#QJ5&q
zzOMkKmLwW@1Rqf|^<Kkjc*9MP{?+4{`cO+P%f-a%NVjS}nqc0iqE<$%HE)p@N&kp_
X1!mE48RVez@T_0|KX&)@$9{ML9th|h
delta 27
jcmeyqhpBxB(|L$$yVNSlbgNQZ=UG$%YU=iTwO0tdtAu
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index fad370877f37672a1bc56aac9406cbd8a6aba669..938f85d449741c9c1f8f53605e5365568f1c24d3 100644
GIT binary patch
delta 626
zcmZ{iv1%MK5QgP9NS!8=E(bxSOS>_KgTNi+E`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02fdbxy;o`I_qv-Hp1^}d!;mJN~Bk#3cIG{Lk^MXe0j%KSziM*Sn!6_{zuxtD{^
O&9i>}e{6Ms@%at?is;S&
delta 26
icmdnLoALZM#tqBVC!f`jn=GceezS^}xY6WaF-HNRa0{LQ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 2b11cbd2cd17c6c3e42280a027bb3f5559f74096..20128ba3e80ba6f782bfcdad2fddb08b9eec378f 100644
GIT binary patch
delta 623
zcmZ{iK}uXf5Qf`T?%>8En{gp;;Q``C0t14AGg-KivR}P<g+1L(S3QlZImBE<$RY%C
zgd9QeB!boN4P&y%s+!j
hULam!AiJejhyF&NlQtr=so~(<5{#YDRzGaAZ(g=YUFX
z-|Z=6cY&daYcKv02YFq`IS}Q^8QJj|$$FAxA(EQb^r6038PtU~B<JlIM*%v{l>j
zYAC3jB4jMMCZ!?Tt-j8Q4~X<_QY0C&H^4I+z||7^Ia;?CO@nxPR6xXlPX
%8(3IH
zua<6%F=ZACbmXi5ARJe4Rj8vv<|yz5zFK~1w#(V^_ICE^uu<*Yd<pKGSK2F(<s
?
z?AJ17iVfbSKSnC*L
|~o!kt@Wo}P$RFA@zi@UU0SPGR%2IpMJYbsAaJ|DlFZq&@w
z%$k4sqt*+l(M}K&8qg4oRLc+C4j4W%PRPfb)Jyr4*%H}Qg=6^24v9sXY#aBt<yp4x
Xu;cF*J<BKutNXUS{=aPdcJulUqFU!T
delta 26
icmX@Jhw;vK#trf6liM`pCZE?>zxl4_C8NoCvG)M0q73B#
diff --git a/src/app.c b/src/app.c
index 485c2495..46856e22 100644
--- a/src/app.c
+++ b/src/app.c
@@ -836,6 +836,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
loadPalette_Color(dataDir_App_());
setThemePalette_Color(d->prefs.theme); /* default UI colors */
loadPrefs_App_(d);
load_Keys(dataDir_App_());
/* See if the user wants to override the window size. */ {
iCommandLineArg *arg = iClob(checkArgument_CommandLine(&d->args, windowWidth_CommandLineOption));
@@ -3069,13 +3070,7 @@ iBool handleCommand_App(const char *cmd) {
}
else if (equal_Command(cmd, "fontpack.enable")) {
const iString *packId = collect_String(suffix_Command(cmd, "id"));
if (arg_Command(cmd)) {
remove_StringSet(d->prefs.disabledFontPacks, packId);
}
else {
insert_StringSet(d->prefs.disabledFontPacks, packId);
}
resetFonts_App();
enablePack_Fonts(packId, arg_Command(cmd));
postCommand_App("navigate.reload");
return iTrue;
}
diff --git a/src/fontpack.c b/src/fontpack.c
index 226392bc..f22ab8dc 100644
--- a/src/fontpack.c
+++ b/src/fontpack.c
@@ -90,6 +90,14 @@ static void load_FontFile_(iFontFile *d, const iBlock *data) {
#endif
}
+static iBool detectMonospace_FontFile_(const iFontFile *d) {
+}
static void unload_FontFile_(iFontFile *d) {
#if defined(LAGRANGE_ENABLE_HARFBUZZ)
/* HarfBuzz objects. */
@@ -300,6 +308,8 @@ static iBlock *readFile_FontPack_(const iFontPack *d, const iString *path) {
return data;
}
+static const char *styles_[max_FontStyle] = { "regular", "italic", "light", "semibold", "bold" };
void handleIniKeyValue_FontPack_(void *context, const iString *table, const iString *key,
const iTomlValue *value) {
iFontPack *d = context;
@@ -359,9 +369,8 @@ void handleIniKeyValue_FontPack_(void *context, const iString *table, const iStr
((int) number_TomlValue(value)) & 1);
}
else if (value->type == string_TomlType) {
const char *styles[max_FontStyle] = { "regular", "italic", "light", "semibold", "bold" };
iForIndices(i, styles) {
if (!cmp_String(key, styles[i]) && !d->loadSpec->styles[i]) {
iForIndices(i, styles_) {
if (!cmp_String(key, styles_[i]) && !d->loadSpec->styles[i]) {
iFontFile *ff = NULL;
iString *fontFileId = concat_Path(d->loadPath, value->value.string);
if (!(ff = findFile_Fonts_(&fonts_, fontFileId))) {
@@ -441,6 +450,7 @@ void setLoadPath_FontPack(iFontPack *d, const iString *path) {
/* Pack ID is based on the file name. */
setRange_String(&d->id, baseName_Path(path));
setRange_String(&d->id, withoutExtension_Path(&d->id));
}
const iString *idFromUrl_FontPack(const iString *url) {
@@ -449,6 +459,7 @@ const iString *idFromUrl_FontPack(const iString *url) {
init_Url(&parts, url);
setRange_String(id, baseName_Path(collectNewRange_String(parts.path)));
setRange_String(id, withoutExtension_Path(id));
return collect_String(id);
}
@@ -592,6 +603,49 @@ void init_Fonts(const char *userDir) {
}
iRelease(f);
}
iForEach(DirFileInfo, entry, iClob(new_DirFileInfo(userFontsDirectory_Fonts_(d)))) {
const iString *entryPath = path_FileInfo(entry.value);
if (endsWithCase_String(entryPath, ".ttf")) {
iFile *f = new_File(entryPath);
iFontFile *font = NULL;
if (open_File(f, readOnly_FileMode)) {
iBlock *data = readAll_File(f);
font = new_FontFile();
load_FontFile_(font, data);
set_String(&font->id, entryPath);
pushBack_ObjectList(fonts_.files, font); /* centralized ownership */
iRelease(font);
delete_Block(data);
}
iRelease(f);
if (!font) {
fprintf(stderr, "[fonts] failed to load: %s\n", cstr_String(entryPath));
continue;
}
iFontPack *pack = new_FontPack();
setStandalone_FontPack(pack, iTrue);
iFontSpec *spec = new_FontSpec();
spec->flags |= user_FontSpecFlag;
if (detectMonospace_FontFile_(font)) {
spec->flags |= monospace_FontSpecFlag;
}
setRange_String(&spec->id, baseName_Path(collect_String(lower_String(&font->id))));
setRange_String(&spec->id, withoutExtension_Path(&spec->id));
replace_String(&spec->id, " ", "-");
setRange_String(&spec->name, baseName_Path(&font->id));
setRange_String(&spec->name, withoutExtension_Path(&spec->name));
set_String(&spec->sourcePath, entryPath);
iForIndices(j, spec->styles) {
spec->styles[j] = ref_Object(font);
}
pushBack_PtrArray(&pack->fonts, spec);
set_String(&pack->id, &spec->id);
pack->loadPath = copy_String(entryPath);
pushBack_PtrArray(&d->packs, pack);
}
}
sortSpecs_Fonts_(d);
}
@@ -679,7 +733,7 @@ iString *infoText_FontPack(const iFontPack *d) {
return str;
}
-const iArray *actions_FontPack(const iFontPack *d) {
+const iArray *actions_FontPack(const iFontPack *d, iBool showInstalled) {
iArray *items = new_Array(sizeof(iMenuItem));
const iFontPackId fp = id_FontPack(d);
const char *fpId = cstr_String(fp.id);
@@ -687,33 +741,44 @@ const iArray *actions_FontPack(const iFontPack *d) {
const iBool isEnabled = !isDisabled_FontPack(d);
if (isInstalled_Fonts(fpId)) {
if (d->version > installed->version) {
pushBack_Array(items, &(iMenuItem){
format_Lang(add_Icon " ${fontpack.upgrade}", fpId, d->version),
SDLK_RETURN, 0, "fontpack.install"
});
pushBack_Array(
items,
&(iMenuItem){ format_Lang(add_Icon " ${fontpack.upgrade}", fpId, d->version),
SDLK_RETURN,
0,
"fontpack.install" });
}
pushBack_Array(items, &(iMenuItem){
format_Lang(isEnabled ? close_Icon " ${fontpack.disable}"
: leftArrowhead_Icon " ${fontpack.enable}", fpId), 0, 0,
format_CStr("fontpack.enable arg:%d id:%s", !isEnabled, fpId) });
if (!d->isReadOnly && installed->loadPath && d->loadPath &&
pushBack_Array(
items,
&(iMenuItem){ format_Lang(isEnabled ? close_Icon " ${fontpack.disable}"
: leftArrowhead_Icon " ${fontpack.enable}",
fpId),
0,
0,
format_CStr("fontpack.enable arg:%d id:%s", !isEnabled, fpId) });
if (!d->isReadOnly && !d->isStandalone && installed->loadPath && d->loadPath &&
!cmpString_String(installed->loadPath, d->loadPath)) {
pushBack_Array(items, &(iMenuItem){
format_Lang(delete_Icon " ${fontpack.delete}", fpId), 0, 0,
format_CStr("fontpack.delete id:%s", fpId) });
pushBack_Array(items,
&(iMenuItem){ format_Lang(delete_Icon " ${fontpack.delete}", fpId),
0,
0,
format_CStr("fontpack.delete id:%s", fpId) });
}
}
else if (d->isStandalone) {
pushBack_Array(items, &(iMenuItem){
format_Lang(add_Icon " ${fontpack.install}", fpId),
SDLK_RETURN, 0, "fontpack.install"
});
pushBack_Array(items, &(iMenuItem){
download_Icon " " saveToDownloads_Label,
0,
0,
"document.save"
});
pushBack_Array(items,
&(iMenuItem){ format_Lang(add_Icon " ${fontpack.install}", fpId),
SDLK_RETURN,
0,
"fontpack.install" });
pushBack_Array(
items, &(iMenuItem){ download_Icon " " saveToDownloads_Label, 0, 0, "document.save" });
pushBack_Array(
items,
&(iMenuItem){
fontpack_Icon " ${fontpack.open.aboutfonts}", 0, 0, "!open url:about:fonts" });
}
return collect_Array(items);
}
@@ -722,8 +787,64 @@ iBool isDisabled_FontPack(const iFontPack *d) {
return contains_StringSet(prefs_App()->disabledFontPacks, &d->id);
}
-const iString *infoPage_Fonts(void) {
+const iPtrArray *disabledSpecs_Fonts_(const iFonts *d) {
const iFontPack *pack = i.ptr;
if (isDisabled_FontPack(pack)) {
iConstForEach(PtrArray, j, &pack->fonts) {
pushBack_PtrArray(list, j.ptr);
}
}
+}
+static const char *boolStr_(int value) {
+}
+static const iString *exportFontPackIni_Fonts_(const iFonts *d, const iRangecc packId) {
appendFormat_String(str, "Fontpack \"%s\" not found.\n", cstr_Rangecc(packId));
return str;
"name has the .fontpack file extension.\n```Fontpack configuration\n");
const iFontSpec *spec = i.ptr;
appendFormat_String(str, "\n[%s]\n", cstr_String(&spec->id));
appendFormat_String(str, "name = \"%s\"\n", cstrCollect_String(quote_String(&spec->name, iFalse)));
appendFormat_String(str, "priority = %d\n", spec->priority);
appendFormat_String(str, "override = %s\n", boolStr_(spec->flags & override_FontSpecFlag));
appendFormat_String(str, "monospace = %s\n", boolStr_(spec->flags & monospace_FontSpecFlag));
appendFormat_String(str, "auxiliary = %s\n", boolStr_(spec->flags & auxiliary_FontSpecFlag));
appendFormat_String(str, "allowspace = %s\n", boolStr_(spec->flags & allowSpacePunct_FontSpecFlag));
for (int j = 0; j < 2; ++j) {
const char *scope = (j == 0 ? "ui" : "doc");
appendFormat_String(str, "%s.height = %.3f\n", scope, spec->heightScale[j]);
appendFormat_String(str, "%s.glyphscale = %.3f\n", scope, spec->glyphScale[j]);
appendFormat_String(str, "%s.voffset = %.3f\n", scope, spec->vertOffsetScale[j]);
}
iForIndices(j, styles_) {
appendFormat_String(str, "%s = \"%s\"\n", styles_[j],
cstrCollect_String(quote_String(&spec->sourcePath, iFalse)));
}
+}
+const iString *infoPage_Fonts(iRangecc query) {
iFonts *d = &fonts_;
query.start++; /* skip the ? */
return exportFontPackIni_Fonts_(d, query);
iString *str = collectNewCStr_String("# ${heading.fontpack.meta}\n"
"=> gemini://skyjake.fi/fonts Download more fonts\n"
"=> about:command?!open%20newtab:1%20gotoheading:1%20url:about:help Using fonts in Lagrange\n"
@@ -734,7 +855,7 @@ const iString *infoPage_Fonts(void) {
iString *currentSourcePath = collectNew_String();
for (int group = 0; group < 2; group++) {
iBool isFirst = iTrue;
iConstForEach(PtrArray, i, specsByPack) {
iConstForEach(PtrArray, i, group == 0 ? specsByPack : disabledSpecs_Fonts_(d)) {
const iFontSpec *spec = i.ptr;
if (isEmpty_String(&spec->sourcePath)) {
continue; /* built-in font */
@@ -753,15 +874,22 @@ const iString *infoPage_Fonts(void) {
isFirst = iFalse;
}
const iString *packId = id_FontPack(pack).id;
appendFormat_String(str, "### %s\n=> %s ${fontpack.meta.viewfile}\n",
appendFormat_String(str, "### %s\n",
isEmpty_String(packId) ? "fonts.ini" :
cstr_String(packId),
cstrCollect_String(makeFileUrl_String(&spec->sourcePath)));
cstr_String(packId));
append_String(str, collect_String(infoText_FontPack(pack)));
iConstForEach(Array, a, actions_FontPack(pack)) {
appendFormat_String(str, "=> %s ${fontpack.meta.viewfile}\n",
cstrCollect_String(makeFileUrl_String(&spec->sourcePath)));
if (pack->isStandalone) {
appendFormat_String(str, "=> about:fonts?%s ${fontpack.export}\n",
cstr_String(packId));
}
iConstForEach(Array, a, actions_FontPack(pack, iFalse)) {
const iMenuItem *item = a.value;
appendFormat_String(str, "=> about:command?%s %s\n",
cstr_String(withSpacesEncoded_String(collectNewCStr_String(item->command))),
appendFormat_String(str,
"=> about:command?%s %s\n",
cstr_String(withSpacesEncoded_String(
collectNewCStr_String(item->command))),
item->label);
}
}
@@ -824,5 +952,32 @@ void install_Fonts(const iString *packId, const iBlock *data) {
reload_Fonts();
}
+void installFontFile_Fonts(const iString *fileName, const iBlock *data) {
write_File(f, data);
+}
+void enablePack_Fonts(const iString *packId, iBool enable) {
remove_StringSet(prefs_App()->disabledFontPacks, packId);
insert_StringSet(prefs_App()->disabledFontPacks, packId);
+}
+void updateActive_Fonts(void) {
+}
iDefineClass(FontFile)
diff --git a/src/fontpack.h b/src/fontpack.h
index fb8d757e..5d592822 100644
--- a/src/fontpack.h
+++ b/src/fontpack.h
@@ -110,22 +110,23 @@ iDeclareType(FontSpec)
iDeclareTypeConstruction(FontSpec)
enum iFontSpecFlags {
fixNunitoKerning_FontSpecFlag = iBit(31), /* manual hardcoded kerning tweaks for Nunito */
};
struct Impl_FontSpec {
const iFontFile *styles[max_FontStyle];
};
@@ -158,25 +159,26 @@ iBool isDisabled_FontPack (const iFontPack *);
iBool isReadOnly_FontPack (const iFontPack *);
const iPtrArray * listSpecs_FontPack (const iFontPack *);
iString * infoText_FontPack (const iFontPack *);
-const iArray * actions_FontPack (const iFontPack *);
+const iArray * actions_FontPack (const iFontPack *, iBool showInstalled);
const iString * idFromUrl_FontPack (const iString *url);
/----------------------------------------------------------------------------------------------/
-iDeclareType(GmDocument)
void init_Fonts (const char *userDir);
void deinit_Fonts (void);
+void enablePack_Fonts (const iString *packId, iBool enable);
+void updateActive_Fonts (void);
const iFontPack * pack_Fonts (const char *packId);
const iFontPack * packByPath_Fonts (const iString *path);
const iFontSpec * findSpec_Fonts (const char *fontId);
const iPtrArray * listPacks_Fonts (void);
const iPtrArray * listSpecs_Fonts (iBool (*filterFunc)(const iFontSpec *));
const iPtrArray * listSpecsByPriority_Fonts (void);
-const iString * infoPage_Fonts (void);
+const iString * infoPage_Fonts (iRangecc query);
void install_Fonts (const iString *fontId, const iBlock *data);
+void installFontFile_Fonts (const iString *fileName, const iBlock *data);
void reload_Fonts (void);
iLocalDef iBool isInstalled_Fonts(const char *packId) {
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 23ebace3..b0851fec 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -479,7 +479,7 @@ static void commit_RunTypesetter_(iRunTypesetter *d, iGmDocument *doc) {
static const int maxLedeLines_ = 10;
-static int applyAttributes_RunTypesetter_(iRunTypesetter *d, iTextAttrib attrib) {
+static void applyAttributes_RunTypesetter_(iRunTypesetter *d, iTextAttrib attrib) {
/* WARNING: This is duplicated in run_Font_(). Make sure they behave identically. */
if (attrib.bold) {
d->run.font = fontWithStyle_Text(d->baseFont, bold_FontStyle);
@@ -495,7 +495,7 @@ static int applyAttributes_RunTypesetter_(iRunTypesetter *d, iTextAttrib attrib)
else {
d->run.font = d->baseFont;
d->run.color = d->baseColor;
}
static iBool typesetOneLine_RunTypesetter_(iWrapText *wrap, iRangecc wrapRange, iTextAttrib attrib,
diff --git a/src/gmrequest.c b/src/gmrequest.c
index f7a22e0a..03a6d999 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -362,7 +362,7 @@ static const iBlock *aboutPageSource_(iRangecc path, iRangecc query) {
return utf8_String(debugInfo_App());
}
if (equalCase_Rangecc(path, "fonts")) {
return utf8_String(infoPage_Fonts());
return utf8_String(infoPage_Fonts(query));
}
if (equalCase_Rangecc(path, "feeds")) {
return utf8_String(entryListPage_Feeds());
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 1039fc2b..48ce5b5f 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1130,7 +1130,8 @@ static void makeFooterButtons_DocumentWidget_(iDocumentWidget *d, const iMenuIte
d->footerButtons,
iClob(newKeyMods_LabelWidget(
items[i].label, items[i].key, items[i].kmods, items[i].command)),
alignLeft_WidgetFlag | drawKey_WidgetFlag);
alignLeft_WidgetFlag | drawKey_WidgetFlag | extraPadding_WidgetFlag);
setPadding1_Widget(as_Widget(button), gap_UI / 2);
checkIcon_LabelWidget(button);
setFont_LabelWidget(button, uiContent_FontId);
}
@@ -1473,7 +1474,7 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
trim_Rangecc(¶m);
/* Detect fontpacks even if the server doesn't use the right media type. */
if (isRequestFinished && equal_Rangecc(param, "application/octet-stream")) {
if (detect_FontPack(&d->sourceContent)) {
if (detect_FontPack(&response->body)) {
param = range_CStr(mimeType_FontPack);
}
}
@@ -1492,6 +1493,42 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
docFormat = plainText_SourceFormat;
setRange_String(&d->sourceMime, param);
}
else if (isRequestFinished && equal_Rangecc(param, "font/ttf")) {
clear_String(&str);
docFormat = gemini_SourceFormat;
setRange_String(&d->sourceMime, param);
format_String(&str, "# TrueType Font\n");
iString *decUrl = collect_String(urlDecode_String(d->mod.url));
iRangecc name = baseName_Path(decUrl);
iBool isInstalled = iFalse;
if (startsWith_String(collect_String(localFilePathFromUrl_String(d->mod.url)),
cstr_String(dataDir_App()))) {
isInstalled = iTrue;
}
appendCStr_String(&str, "## ");
appendRange_String(&str, name);
appendCStr_String(&str, "\n\n");
appendCStr_String(
&str, cstr_Lang(isInstalled ? "truetype.help.installed" : "truetype.help"));
appendCStr_String(&str, "\n");
if (!isInstalled) {
makeFooterButtons_DocumentWidget_(
d,
(iMenuItem[]){
{ add_Icon " ${fontpack.install.ttf}",
SDLK_RETURN,
0,
format_CStr("!fontpack.install ttf:1 name:%s",
cstr_Rangecc(name)) },
{ folder_Icon " ${fontpack.open.fontsdir}",
SDLK_d,
0,
format_CStr("!open url:%s/fonts",
cstrCollect_String(makeFileUrl_String(dataDir_App())))
}
}, 2);
}
}
else if (isRequestFinished &&
(equal_Rangecc(param, "application/zip") ||
(startsWith_Rangecc(param, "application/") &&
@@ -1499,32 +1536,39 @@ static void updateDocument_DocumentWidget_(iDocumentWidget *d,
clear_String(&str);
docFormat = gemini_SourceFormat;
setRange_String(&d->sourceMime, param);
iString *key = collectNew_String();
toString_Sym(SDLK_s, KMOD_PRIMARY, key);
format_String(&str, "# %s\n", zipPageHeading_(param));
appendFormat_String(&str,
cstr_Lang("doc.archive"),
cstr_Rangecc(baseName_Path(d->mod.url)));
if (equal_Rangecc(param, mimeType_FontPack)) {
/* Show some information about fontpacks, and set up footer actions. */
iArchive *zip = iClob(new_Archive());
if (openData_Archive(zip, &d->sourceContent)) {
if (openData_Archive(zip, &response->body)) {
iFontPack *fp = new_FontPack();
setUrl_FontPack(fp, d->mod.url);
setStandalone_FontPack(fp, iTrue);
if (loadArchive_FontPack(fp, zip)) {
appendFormat_String(&str, "\n\n%s",
appendFormat_String(&str, "## %s\n%s",
cstr_String(id_FontPack(fp).id),
cstrCollect_String(infoText_FontPack(fp)));
}
const iArray *actions = actions_FontPack(fp);
appendCStr_String(&str, "\n");
appendCStr_String(&str, cstr_Lang("fontpack.help"));
appendCStr_String(&str, "\n");
const iArray *actions = actions_FontPack(fp, iTrue);
makeFooterButtons_DocumentWidget_(d, constData_Array(actions),
size_Array(actions));
delete_FontPack(fp);
}
}
appendCStr_String(&str, "\n\n");
else {
appendFormat_String(&str,
cstr_Lang("doc.archive"),
cstr_Rangecc(baseName_Path(d->mod.url)));
appendCStr_String(&str, "\n");
}
appendCStr_String(&str, "\n");
iString *localPath = localFilePathFromUrl_String(d->mod.url);
if (!localPath) {
iString *key = collectNew_String();
toString_Sym(SDLK_s, KMOD_PRIMARY, key);
appendFormat_String(&str, "%s\n\n",
format_CStr(cstr_Lang("error.unsupported.suggestsave"),
cstr_String(key),
@@ -3267,10 +3311,17 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
}
return iTrue;
}
const iString *id = idFromUrl_FontPack(d->mod.url);
install_Fonts(id, &d->sourceContent);
postCommandf_App("open gotoheading:%s url:about:fonts", cstr_String(id));
if (argLabel_Command(cmd, "ttf")) {
iAssert(!cmp_String(&d->sourceMime, "font/ttf"));
installFontFile_Fonts(collect_String(suffix_Command(cmd, "name")), &d->sourceContent);
postCommand_App("open url:about:fonts");
}
else {
const iString *id = idFromUrl_FontPack(d->mod.url);
install_Fonts(id, &d->sourceContent);
postCommandf_App("open gotoheading:%s url:about:fonts", cstr_String(id));
}
return iTrue;
}
return iFalse;
@@ -5199,6 +5250,7 @@ void updateSize_DocumentWidget(iDocumentWidget *d) {
d->drawBufs->flags |= updateSideBuf_DrawBufsFlag;
updateVisible_DocumentWidget_(d);
invalidate_DocumentWidget_(d);
}
#if 0
diff --git a/src/ui/text.c b/src/ui/text.c
index 4baf60d3..106c55e9 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -458,7 +458,7 @@ static void initFonts_Text_(iText *d) {
/* Check if there are auxiliary fonts available and set those up, too. */
iConstForEach(PtrArray, s, listSpecsByPriority_Fonts()) {
const iFontSpec *spec = s.ptr;
if (spec->flags & auxiliary_FontSpecFlag) {
if (spec->flags & (auxiliary_FontSpecFlag | user_FontSpecFlag)) {
const int fontId = size_Array(&d->fonts);
resize_Array(&d->fonts, fontId + maxVariants_Fonts);
setupFontVariants_Text_(d, spec, fontId);
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).