jetpack-fonts.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <?php
  2. add_filter( 'typekit_add_font_category_rules', function( $category_rules ) {
  3. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  4. 'caption,
  5. td,
  6. th',
  7. array(
  8. array( 'property' => 'font-weight', 'value' => 'normal' ),
  9. )
  10. );
  11. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  12. 'body,
  13. button,
  14. input,
  15. select,
  16. textarea',
  17. array(
  18. array( 'property' => 'font-family', 'value' => 'Lato, Helvetica, sans-serif' ),
  19. array( 'property' => 'font-size', 'value' => '18px' ),
  20. array( 'property' => 'font-weight', 'value' => '300' ),
  21. )
  22. );
  23. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  24. 'h1,
  25. h2,
  26. h3,
  27. h4,
  28. h5,
  29. h6',
  30. array(
  31. array( 'property' => 'font-family', 'value' => 'Lato, Helvetica, sans-serif' ),
  32. array( 'property' => 'font-weight', 'value' => 'bold' ),
  33. )
  34. );
  35. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  36. 'h1',
  37. array(
  38. array( 'property' => 'font-size', 'value' => '2.333em' ),
  39. )
  40. );
  41. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  42. 'h2',
  43. array(
  44. array( 'property' => 'font-size', 'value' => '1.667em' ),
  45. )
  46. );
  47. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  48. 'h3',
  49. array(
  50. array( 'property' => 'font-size', 'value' => '1.333em' ),
  51. )
  52. );
  53. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  54. 'h4',
  55. array(
  56. array( 'property' => 'font-size', 'value' => '1.11em' ),
  57. )
  58. );
  59. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  60. 'h5',
  61. array(
  62. array( 'property' => 'font-size', 'value' => '1em' ),
  63. )
  64. );
  65. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  66. 'h6',
  67. array(
  68. array( 'property' => 'font-size', 'value' => '0.778em' ),
  69. )
  70. );
  71. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  72. 'b,
  73. strong',
  74. array(
  75. array( 'property' => 'font-weight', 'value' => 'bold' ),
  76. )
  77. );
  78. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  79. 'cite,
  80. dfn,
  81. em,
  82. i',
  83. array(
  84. array( 'property' => 'font-style', 'value' => 'italic' ),
  85. )
  86. );
  87. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  88. 'blockquote',
  89. array(
  90. array( 'property' => 'font-size', 'value' => '1.11em' ),
  91. array( 'property' => 'font-style', 'value' => 'italic' ),
  92. )
  93. );
  94. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  95. 'pre',
  96. array(
  97. array( 'property' => 'font-family', 'value' => '"Courier 10 Pitch", Courier, monospace' ),
  98. array( 'property' => 'font-size', 'value' => '15px' ),
  99. )
  100. );
  101. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  102. 'code,
  103. kbd,
  104. tt,
  105. var',
  106. array(
  107. array( 'property' => 'font-size', 'value' => '15px' ),
  108. array( 'property' => 'font-family', 'value' => 'Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace' ),
  109. )
  110. );
  111. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  112. 'sub,
  113. sup',
  114. array(
  115. array( 'property' => 'font-size', 'value' => '75%' ),
  116. )
  117. );
  118. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  119. 'small',
  120. array(
  121. array( 'property' => 'font-size', 'value' => '75%' ),
  122. )
  123. );
  124. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  125. 'big',
  126. array(
  127. array( 'property' => 'font-size', 'value' => '125%' ),
  128. )
  129. );
  130. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  131. 'dt',
  132. array(
  133. array( 'property' => 'font-weight', 'value' => 'bold' ),
  134. )
  135. );
  136. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  137. 'th',
  138. array(
  139. array( 'property' => 'font-weight', 'value' => 'bold' ),
  140. )
  141. );
  142. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  143. 'button,
  144. input[type="button"],
  145. input[type="reset"],
  146. input[type="submit"]',
  147. array(
  148. array( 'property' => 'font-size', 'value' => '18px' ),
  149. array( 'property' => 'font-weight', 'value' => 'bold' ),
  150. )
  151. );
  152. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  153. '.search-form label:before',
  154. array(
  155. array( 'property' => 'font-family', 'value' => 'Genericons' ),
  156. array( 'property' => 'font-size', 'value' => '16px' ),
  157. )
  158. );
  159. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  160. '.main-navigation li li',
  161. array(
  162. array( 'property' => 'font-size', 'value' => '0.778em' ),
  163. )
  164. );
  165. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  166. '.main-navigation li li li',
  167. array(
  168. array( 'property' => 'font-size', 'value' => 'inherit' ),
  169. )
  170. );
  171. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  172. '.site-main .comment-navigation,
  173. .site-main .posts-navigation,
  174. .site-main .post-navigation',
  175. array(
  176. array( 'property' => 'font-size', 'value' => '0.778em' ),
  177. array( 'property' => 'font-weight', 'value' => 'bold' ),
  178. )
  179. );
  180. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  181. '.screen-reader-text:active,
  182. .screen-reader-text:focus,
  183. .screen-reader-text:hover',
  184. array(
  185. array( 'property' => 'font-size', 'value' => '14px' ),
  186. array( 'property' => 'font-weight', 'value' => 'bold' ),
  187. )
  188. );
  189. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  190. '.widget-title',
  191. array(
  192. array( 'property' => 'font-size', 'value' => '1.333em' ),
  193. array( 'property' => 'font-weight', 'value' => 'bold' ),
  194. )
  195. );
  196. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  197. '#wp-calendar caption',
  198. array(
  199. array( 'property' => 'font-weight', 'value' => 'bold' ),
  200. )
  201. );
  202. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  203. '.site-title',
  204. array(
  205. array( 'property' => 'font-size', 'value' => '1.667em' ),
  206. array( 'property' => 'font-family', 'value' => 'Lato, Helvetica, sans-serif' ),
  207. )
  208. );
  209. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  210. '.site-description',
  211. array(
  212. array( 'property' => 'font-size', 'value' => '0.778em' ),
  213. array( 'property' => 'font-weight', 'value' => '300' ),
  214. )
  215. );
  216. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  217. '.entry-title,
  218. .page-title',
  219. array(
  220. array( 'property' => 'font-size', 'value' => '1.667em' ),
  221. )
  222. );
  223. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  224. '.page-title',
  225. array(
  226. array( 'property' => 'font-size', 'value' => '1.11em' ),
  227. )
  228. );
  229. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  230. '.entry-footer,
  231. .entry-meta',
  232. array(
  233. array( 'property' => 'font-size', 'value' => '0.778em' ),
  234. )
  235. );
  236. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  237. '.entry-categories,
  238. .entry-tags',
  239. array(
  240. array( 'property' => 'font-weight', 'value' => 'bold' ),
  241. )
  242. );
  243. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  244. '.entry-footer a,
  245. .entry-meta a',
  246. array(
  247. array( 'property' => 'font-weight', 'value' => 'normal' ),
  248. )
  249. );
  250. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  251. '.archive .entry-content,
  252. .archive .entry-summary,
  253. .blog .entry-content,
  254. .blog .entry-summary,
  255. .search .entry-content,
  256. .search .entry-summary',
  257. array(
  258. array( 'property' => 'font-size', 'value' => '1em' ),
  259. )
  260. );
  261. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  262. 'a.more-link',
  263. array(
  264. array( 'property' => 'font-size', 'value' => '0.778em' ),
  265. array( 'property' => 'font-weight', 'value' => 'bold' ),
  266. )
  267. );
  268. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  269. '.entry-author',
  270. array(
  271. array( 'property' => 'font-size', 'value' => '1em' ),
  272. )
  273. );
  274. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  275. '.site-info',
  276. array(
  277. array( 'property' => 'font-size', 'value' => '0.778em' ),
  278. array( 'property' => 'font-weight', 'value' => 'bold' ),
  279. )
  280. );
  281. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  282. '.error404 .site-title,
  283. .search-no-results .site-title,
  284. .singular .site-title',
  285. array(
  286. array( 'property' => 'font-size', 'value' => '1.11em' ),
  287. )
  288. );
  289. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  290. '.singular .entry-title',
  291. array(
  292. array( 'property' => 'font-size', 'value' => '1.667em' ),
  293. )
  294. );
  295. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  296. '.entry-format',
  297. array(
  298. array( 'property' => 'font-weight', 'value' => 'bold' ),
  299. )
  300. );
  301. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  302. '.format-link .entry-title a:after',
  303. array(
  304. array( 'property' => 'font-family', 'value' => 'Genericons' ),
  305. array( 'property' => 'font-size', 'value' => '48px' ),
  306. )
  307. );
  308. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  309. '.comment-reply-title,
  310. .comments-title',
  311. array(
  312. array( 'property' => 'font-size', 'value' => '1.667em' ),
  313. )
  314. );
  315. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  316. '.comment-author .fn',
  317. array(
  318. array( 'property' => 'font-weight', 'value' => 'bold' ),
  319. )
  320. );
  321. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  322. '.comment-metadata',
  323. array(
  324. array( 'property' => 'font-size', 'value' => '0.778em' ),
  325. )
  326. );
  327. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  328. '.comment-reply-link',
  329. array(
  330. array( 'property' => 'font-weight', 'value' => 'bold' ),
  331. )
  332. );
  333. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  334. '.no-comments',
  335. array(
  336. array( 'property' => 'font-style', 'value' => 'italic' ),
  337. )
  338. );
  339. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  340. '#infinite-handle span',
  341. array(
  342. array( 'property' => 'font-size', 'value' => '1.11em' ),
  343. array( 'property' => 'font-weight', 'value' => 'bold' ),
  344. )
  345. );
  346. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  347. '.gallery-caption',
  348. array(
  349. array( 'property' => 'font-size', 'value' => '0.778em' ),
  350. )
  351. );
  352. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  353. 'h1',
  354. array(
  355. array( 'property' => 'font-size', 'value' => '4.44em' ),
  356. ),
  357. array(
  358. 'screen and (min-width: 768px)',
  359. )
  360. );
  361. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  362. 'h2',
  363. array(
  364. array( 'property' => 'font-size', 'value' => '1.667em' ),
  365. ),
  366. array(
  367. 'screen and (min-width: 768px)',
  368. )
  369. );
  370. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  371. 'h3',
  372. array(
  373. array( 'property' => 'font-size', 'value' => '1.333em' ),
  374. ),
  375. array(
  376. 'screen and (min-width: 768px)',
  377. )
  378. );
  379. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  380. 'h4',
  381. array(
  382. array( 'property' => 'font-size', 'value' => '1.11em' ),
  383. ),
  384. array(
  385. 'screen and (min-width: 768px)',
  386. )
  387. );
  388. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  389. 'h5',
  390. array(
  391. array( 'property' => 'font-size', 'value' => '1em' ),
  392. ),
  393. array(
  394. 'screen and (min-width: 768px)',
  395. )
  396. );
  397. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  398. 'h6',
  399. array(
  400. array( 'property' => 'font-size', 'value' => '0.778em' ),
  401. ),
  402. array(
  403. 'screen and (min-width: 768px)',
  404. )
  405. );
  406. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  407. '.site-title',
  408. array(
  409. array( 'property' => 'font-size', 'value' => '2.333em' ),
  410. ),
  411. array(
  412. 'screen and (min-width: 768px)',
  413. )
  414. );
  415. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  416. '.site-description',
  417. array(
  418. array( 'property' => 'font-size', 'value' => '1.333em' ),
  419. ),
  420. array(
  421. 'screen and (min-width: 768px)',
  422. )
  423. );
  424. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  425. '.entry-title',
  426. array(
  427. array( 'property' => 'font-size', 'value' => '2.333em' ),
  428. ),
  429. array(
  430. 'screen and (min-width: 768px)',
  431. )
  432. );
  433. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  434. '.page-title',
  435. array(
  436. array( 'property' => 'font-size', 'value' => '2.333em' ),
  437. ),
  438. array(
  439. 'screen and (min-width: 768px)',
  440. )
  441. );
  442. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  443. '.entry-author',
  444. array(
  445. array( 'property' => 'font-size', 'value' => '1.11em' ),
  446. ),
  447. array(
  448. 'screen and (min-width: 768px)',
  449. )
  450. );
  451. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  452. '.singular .entry-title',
  453. array(
  454. array( 'property' => 'font-size', 'value' => '2.333em' ),
  455. ),
  456. array(
  457. 'screen and (min-width: 768px)',
  458. )
  459. );
  460. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  461. '.archive .entry-content,
  462. .archive .entry-summary,
  463. .blog .entry-content,
  464. .blog .entry-summary,
  465. .search .entry-content,
  466. .search .entry-summary',
  467. array(
  468. array( 'property' => 'font-size', 'value' => '1.11em' ),
  469. ),
  470. array(
  471. 'screen and (min-width: 768px)',
  472. )
  473. );
  474. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  475. 'h1',
  476. array(
  477. array( 'property' => 'font-size', 'value' => '5.55em' ),
  478. ),
  479. array(
  480. 'screen and (min-width: 1060px)',
  481. )
  482. );
  483. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  484. 'h2',
  485. array(
  486. array( 'property' => 'font-size', 'value' => '2.333em' ),
  487. ),
  488. array(
  489. 'screen and (min-width: 1060px)',
  490. )
  491. );
  492. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  493. 'h3',
  494. array(
  495. array( 'property' => 'font-size', 'value' => '1.667em' ),
  496. ),
  497. array(
  498. 'screen and (min-width: 1060px)',
  499. )
  500. );
  501. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  502. 'h4',
  503. array(
  504. array( 'property' => 'font-size', 'value' => '1.11em' ),
  505. ),
  506. array(
  507. 'screen and (min-width: 1060px)',
  508. )
  509. );
  510. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  511. 'blockquote',
  512. array(
  513. array( 'property' => 'font-size', 'value' => '1.333em' ),
  514. ),
  515. array(
  516. 'screen and (min-width: 1060px)',
  517. )
  518. );
  519. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  520. '.site-title',
  521. array(
  522. array( 'property' => 'font-size', 'value' => '5.55em' ),
  523. ),
  524. array(
  525. 'screen and (min-width: 1060px)',
  526. )
  527. );
  528. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  529. '.site-description',
  530. array(
  531. array( 'property' => 'font-size', 'value' => '1.667em' ),
  532. ),
  533. array(
  534. 'screen and (min-width: 1060px)',
  535. )
  536. );
  537. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  538. '.site-main .comment-navigation,
  539. .site-main .posts-navigation,
  540. .site-main .post-navigation',
  541. array(
  542. array( 'property' => 'font-size', 'value' => '1.11em' ),
  543. ),
  544. array(
  545. 'screen and (min-width: 1060px)',
  546. )
  547. );
  548. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  549. '.error404 .site-title,
  550. .search-no-results .site-title,
  551. .singular .site-title',
  552. array(
  553. array( 'property' => 'font-size', 'value' => '1.667em' ),
  554. ),
  555. array(
  556. 'screen and (min-width: 1060px)',
  557. )
  558. );
  559. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  560. '.singular .entry-title',
  561. array(
  562. array( 'property' => 'font-size', 'value' => '4.44em' ),
  563. ),
  564. array(
  565. 'screen and (min-width: 1060px)',
  566. )
  567. );
  568. return $category_rules;
  569. } );