Projet

Général

Profil

Paste
Télécharger (26 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / adaptivetheme / at_core / inc / fonts.inc @ 74f6bef0

1
<?php
2

    
3
/**
4
 * @file
5
 * Font Elements Config Array.
6
 *
7
 * The fonts array is used by the fonts sub-system to generate forms,
8
 * build stylesheets and load font styles.
9
 */
10
function font_elements() {
11
  $elements_array = &drupal_static(__FUNCTION__, array());
12
  if (empty($elements_array)) {
13
    $elements_array = array(
14
      'base' => array(
15
        'type' => 'default',
16
        'subtype' => 'global',
17
        'element' => 'bf',
18
        'selector' => 'body,.ui-widget', // add the jQuery UI widget selector
19
        'setting' => 'base_font',
20
      ),
21
      'site_name' => array(
22
        'type' => 'title',
23
        'subtype' => 'branding',
24
        'element' => 'sn',
25
        'selector' => '#site-name',
26
        'setting' => 'site_name_font',
27
      ),
28
      'site_slogan' => array(
29
        'type' => 'title',
30
        'subtype' => 'branding',
31
        'element' => 'ss',
32
        'selector' => '#site-slogan',
33
        'setting' => 'site_slogan_font',
34
      ),
35
      'page_title' => array(
36
        'type' => 'title',
37
        'subtype' => 'global',
38
        'element' => 'pt',
39
        'selector' => '#page-title',
40
        'setting' => 'page_title_font',
41
      ),
42
      'node_title' => array(
43
        'type' => 'title',
44
        'subtype' => 'entity_title',
45
        'element' => 'nt',
46
        'selector' => '.node-title',
47
        'setting' => 'node_title_font',
48
      ),
49
      'comment_title' => array(
50
        'type' => 'title',
51
        'subtype' => 'entity_title',
52
        'element' => 'ct',
53
        'selector' => '.comment-title',
54
        'setting' => 'comment_title_font',
55
      ),
56
      'block_title' => array(
57
        'type' => 'title',
58
        'subtype' => 'entity_title',
59
        'element' => 'bt',
60
        'selector' => '.block-title',
61
        'setting' => 'block_title_font',
62
      ),
63
      'content_headings_h1h4' => array(
64
        'type' => 'heading',
65
        'subtype' => 'heading_group',
66
        'element' => 'h1h4',
67
        'selector' => 'h1,h2,h3,h4',
68
        'setting' => 'content_headings_h1h4_font',
69
      ),
70
      'content_headings_h5h6' => array(
71
        'type' => 'heading',
72
        'subtype' => 'heading_group',
73
        'element' => 'h5h6',
74
        'selector' => 'h5,h6',
75
        'setting' => 'content_headings_h5h6_font',
76
      ),
77
      'content_headings_h1' => array(
78
        'type' => 'heading',
79
        'subtype' => 'heading_level',
80
        'element' => 'h1',
81
        'selector' => 'h1',
82
        'setting' => 'h1_font',
83
      ),
84
      'content_headings_h2' => array(
85
        'type' => 'heading',
86
        'subtype' => 'heading_level',
87
        'element' => 'h2',
88
        'selector' => 'h2',
89
        'setting' => 'h2_font',
90
      ),
91
      'content_headings_h3' => array(
92
        'type' => 'heading',
93
        'subtype' => 'heading_level',
94
        'element' => 'h3',
95
        'selector' => 'h3',
96
        'setting' => 'h3_font',
97
      ),
98
      'content_headings_h4' => array(
99
        'type' => 'heading',
100
        'subtype' => 'heading_level',
101
        'element' => 'h4',
102
        'selector' => 'h4',
103
        'setting' => 'h4_font',
104
      ),
105
      'content_headings_h5' => array(
106
        'type' => 'heading',
107
        'subtype' => 'heading_level',
108
        'element' => 'h5',
109
        'selector' => 'h5',
110
        'setting' => 'h5_font',
111
      ),
112
      'content_headings_h6' => array(
113
        'type' => 'heading',
114
        'subtype' => 'heading_level',
115
        'element' => 'h6',
116
        'selector' => 'h6',
117
        'setting' => 'h6_font',
118
      ),
119
      'main_menu' => array(
120
        'type' => 'menu',
121
        'subtype' => 'menu_variable',
122
        'element' => 'mm',
123
        'selector' => '#menu-bar .menu-wrapper,#primary-menu-bar .menu-wrapper',
124
        'setting' => 'main_menu_font',
125
      ),
126
      'secondary_menu' => array(
127
        'type' => 'menu',
128
        'subtype' => 'menu_variable',
129
        'element' => 'sm',
130
        'selector' => '#secondary-menu-bar .menu-wrapper,#menu-bar #block-system-user-menu',
131
        'setting' => 'secondary_menu_font',
132
      ),
133
      'block_menus' => array(
134
        'type' => 'menu',
135
        'subtype' => 'menu_blocks',
136
        'element' => 'bm',
137
        'selector' => 'nav.block .block-content',
138
        'setting' => 'block_menu_font',
139
      ),
140
      'selectors' => array(
141
        'type' => 'custom',
142
        'subtype' => '',
143
        'element' => 'css',
144
        'selector' => 'custom_css',
145
        'setting' => 'selectors_font',
146
      ),
147
    );
148
  }
149

    
150
  return $elements_array;
151
}
152

    
153
/**
154
 * Return lists of font names keyed by element.
155
 *
156
 * @param $type
157
 * @param $element
158
 */
159
function font_list($type, $element) {
160
  $font_list = array();
161

    
162
  // websafe font list
163
  if ($type === 'wsf') {
164
    $wsf_fonts = websafe_fonts_list($element);
165
    if (!empty($wsf_fonts)) {
166
      $font_list = $wsf_fonts;
167
    }
168
  }
169
  // Google font list
170
  if ($type === 'gwf') {
171
    $gwf_fonts = google_fonts_list($element);
172
    if (!empty($gwf_fonts)) {
173
      $font_list = $gwf_fonts;
174
    }
175
  }
176
  // @font-your-face font list
177
  if ($type === 'fyf') {
178
    $fyf_fonts = font_your_face_fonts_list($element);
179
    if (!empty($fyf_fonts)) {
180
      $font_list = $fyf_fonts;
181
    }
182
  }
183

    
184
  return array_unique($font_list);
185
}
186

    
187
/**
188
 * Websafe fonts list.
189
 * These stacks are my own and I spent years working with these, testing and
190
 * checking platform and browser support. The work very well accross platform.
191
 * I love all these fonts and its no accident that 6 of the 10 stacks start
192
 * with a Microsoft font. Whose says MS can't design a good font?
193
 *
194
 * Note, if you are going to *borrow* these and use them in your own theme, book,
195
 * etc then do me the courtesy of attribution; you know who you are.
196
 *
197
 * @param $element
198
 */
199
function websafe_fonts_list($element) {
200
  $fonts = &drupal_static(__FUNCTION__, array());
201
  if (empty($fonts)) {
202
    $fonts = array(
203
      "$element-sss" => t("'Trebuchet MS', 'Helvetica Neue', Arial, Helvetica, sans-serif"),
204
      "$element-ssl" => t("Verdana, Geneva, 'DejaVu Sans', Arial, Helvetica, sans-serif"),
205
      "$element-a"   => t("Arial, Helvetica, sans-serif"),
206
      "$element-cc"  => t("Calibri, Candara, Arial, Helvetica, sans-serif"),
207
      "$element-m"   => t("'Segoe UI', 'Myriad Pro', Myriad, Arial, Helvetica, sans-serif"),
208
      "$element-l"   => t("'Lucida Sans Unicode', 'Lucida Sans', 'Lucida Grande', Verdana, Geneva, sans-serif"),
209
      "$element-i"   => t("Impact, Haettenschweiler, 'Franklin Gothic Bold', Charcoal, 'Helvetica Inserat', 'Bitstream Vera Sans Bold', 'Arial Black', sans-serif"),
210
      "$element-ss"  => t("Garamond, Perpetua, 'Times New Roman', serif"),
211
      "$element-sl"  => t("Georgia, Baskerville, Palatino, 'Palatino Linotype', 'Book Antiqua', 'Times New Roman', serif"),
212
      "$element-ms"  => t("Consolas, Monaco, 'Courier New', Courier, monospace, sans-serif"),
213
    );
214
  }
215

    
216
  return $fonts;
217
}
218

    
219
/**
220
 * @font-your-face.
221
 * This requires the @font-your-face module to be enabled and at least one font
222
 * enabled and set to "add selector in theme CSS". Adaptivetheme will pull the
223
 * enabled fonts and allow them to be used for styling elements in the site via
224
 * each sub-themes appearance settings.
225
 *
226
 * @pararm $element
227
 */
228
function font_your_face_fonts_list($element) {
229
  $fonts = &drupal_static(__FUNCTION__, array());
230
  if (empty($fonts)) {
231
    $font_your_face_enabled = font_your_face_fonts_enabled();
232
    if ($font_your_face_enabled == TRUE) {
233
      $enabled_fonts = fontyourface_get_fonts('enabled = 1');
234
      if (!empty($enabled_fonts)) {
235
        foreach ($enabled_fonts as $font) {
236
          // <none> is "-- add selector in theme CSS --" in fontyourface settings
237
          if ($font->css_selector === '<none>') {
238
            $key = drupal_html_class("$element-$font->name");
239
            $value = $font->name;
240
            $fonts[$key] = $value;
241
          }
242
        }
243
      }
244
    }
245
  }
246

    
247
  return $fonts;
248
}
249

    
250
/**
251
 * Check if there are available fonts, return boolean.
252
 * There are a number of places in forms and other functions we need to know
253
 * if any font-your-face fonts are enabled and set to <none> and therefor
254
 * available for use in the theme settings.
255
 */
256
function font_your_face_fonts_enabled() {
257
  $fonts_enabled = FALSE;
258
  if (module_exists('fontyourface')) {
259
    $enabled_fonts = fontyourface_get_fonts('enabled = 1');
260
    if (!empty($enabled_fonts)) {
261
      foreach ($enabled_fonts as $font) {
262
        if ($font->css_selector === '<none>') {
263
          $fonts[] = $font;
264
        }
265
      }
266
    }
267
    if (!empty($fonts)) {
268
      $fonts_enabled = TRUE;
269
    }
270
  }
271

    
272
  return $fonts_enabled;
273
}
274

    
275

    
276
/**
277
 * Google font charsets.
278
 */
279
function google_font_charsets() {
280
  $charset_array = &drupal_static(__FUNCTION__, array());
281
  if (empty($charset_array)) {
282
    $charset_array = array(
283
      'latin' => t('Latin'),
284
      'latin-ext' => t('Latin extended'),
285
      'greek' => t('Greek'),
286
      'greek-ext' => t('Greek extended'),
287
      'cyrillic' => t('Cyrillic'),
288
      'cyrillic-ext' => t('Cyrillic extended'),
289
      'khmer' => t('Khmer'),
290
      'vietnamese' => t('Vietnamese'),
291
    );
292
  }
293

    
294
  return $charset_array;
295
}
296

    
297
/**
298
 * Google font styles.
299
 */
300
function google_font_styles() {
301
  $styles_array = &drupal_static(__FUNCTION__, array());
302
  if (empty($styles_array)) {
303
    $styles_array = array(
304
      '300' => t('Book 300'),
305
      '300italic' => t('Book 300 Italic'),
306
      '400' => t('Normal 400'),
307
      '400italic' => t('Normal 400 Italic'),
308
      '700' => t('Bold 700'),
309
      '700italic' => t('Bold 700 Italic'),
310
    );
311
  }
312

    
313
  return $styles_array;
314
}
315

    
316
/**
317
 * Build an array of Google web fonts.
318
 * Deprecated.
319
 *
320
 * @pararm $element
321
 * TODO: remove this function, first check everything is working in the new system.
322
 */
323
function google_fonts_list($element) {
324
  $fonts = &drupal_static(__FUNCTION__, array());
325
  if (empty($fonts)) {
326
    $google_fonts = google_font_names();
327
    foreach ($google_fonts as $font) {
328
      $key = drupal_html_class("$element-$font");
329
      $value = $font;
330
      $fonts[$key] = $value;
331
    }
332
  }
333

    
334
  return $fonts;
335
}
336

    
337
/**
338
 * Basic Google Fonts.
339
 * Google add new fonts on a regular basis and we will provide patches and
340
 * updates for this file periodically. For a more up to date approach use the
341
 * @font-your-face module, especially if you need Greek, Cryillic or other
342
 * variants. Last update: 27/02/2012
343
 */
344
function google_font_names() {
345
  $google_font_names_array = &drupal_static(__FUNCTION__, array());
346
  if (empty($google_font_names_array)) {
347
    // Try to get the list from the cache table.
348
    if ($cache = cache_get('at_google_font_names')) {
349
      $google_font_names_array = $cache->data;
350
    }
351
    // Nope?
352
    else {
353
      $google_font_names_array = array(
354
        'Abel',
355
        'Abril Fatface',
356
        'Aclonica',
357
        'Acme',
358
        'Actor',
359
        'Adamina',
360
        'Aguafina Script',
361
        'Aladin',
362
        'Aldrich',
363
        'Alegreya',
364
        'Alegreya SC',
365
        'Alex Brush',
366
        'Alfa Slab One',
367
        'Alice',
368
        'Alike',
369
        'Alike Angular',
370
        'Allan',
371
        'Allerta',
372
        'Allerta Stencil',
373
        'Allura',
374
        'Almendra',
375
        'Almendra SC',
376
        'Amaranth',
377
        'Amatic SC',
378
        'Amethysta',
379
        'Andada',
380
        'Andika',
381
        'Angkor',
382
        'Annie Use Your Telescope',
383
        'Anonymous Pro',
384
        'Antic',
385
        'Anton',
386
        'Arapey',
387
        'Arbutus',
388
        'Architects Daughter',
389
        'Arimo',
390
        'Arizonia',
391
        'Armata',
392
        'Artifika',
393
        'Arvo',
394
        'Asap',
395
        'Asset',
396
        'Astloch',
397
        'Asul',
398
        'Atomic Age',
399
        'Aubrey',
400
        'Bad Script',
401
        'Balthazar',
402
        'Bangers',
403
        'Basic',
404
        'Battambang',
405
        'Baumans',
406
        'Bayon',
407
        'Belgrano',
408
        'Bentham',
409
        'Bevan',
410
        'Bigshot One',
411
        'Bilbo',
412
        'Bilbo Swash Caps',
413
        'Bitter',
414
        'Black Ops One',
415
        'Bokor',
416
        'Bonbon',
417
        'Boogaloo',
418
        'Bowlby One',
419
        'Bowlby One SC',
420
        'Brawler',
421
        'Bree Serif',
422
        'Bubblegum Sans',
423
        'Buda',
424
        'Buenard',
425
        'Butcherman',
426
        'Butterfly Kids',
427
        'Cabin',
428
        'Cabin Condensed',
429
        'Cabin Sketch',
430
        'Caesar Dressing',
431
        'Cagliostro',
432
        'Calligraffitti',
433
        'Cambo',
434
        'Candal',
435
        'Cantarell',
436
        'Cardo',
437
        'Carme',
438
        'Carter One',
439
        'Caudex',
440
        'Cedarville Cursive',
441
        'Ceviche One',
442
        'Changa One',
443
        'Chango',
444
        'Chelsea Market',
445
        'Chenla',
446
        'Cherry Cream Soda',
447
        'Chewy',
448
        'Chicle',
449
        'Chivo',
450
        'Coda',
451
        'Coda Caption',
452
        'Comfortaa',
453
        'Coming Soon',
454
        'Concert One',
455
        'Condiment',
456
        'Content',
457
        'Contrail One',
458
        'Convergence',
459
        'Cookie',
460
        'Copse',
461
        'Corben',
462
        'Cousine',
463
        'Coustard',
464
        'Covered By Your Grace',
465
        'Crafty Girls',
466
        'Creepster',
467
        'Crete Round',
468
        'Crimson Text',
469
        'Crushed',
470
        'Cuprum',
471
        'Damion',
472
        'Dancing Script',
473
        'Dangrek',
474
        'Dawning of a New Day',
475
        'Days One',
476
        'Delius',
477
        'Delius Swash Caps',
478
        'Delius Unicase',
479
        'Devonshire',
480
        'Didact Gothic',
481
        'Diplomata',
482
        'Diplomata SC',
483
        'Doppio One',
484
        'Dorsa',
485
        'Dr Sugiyama',
486
        'Droid Sans',
487
        'Droid Sans Mono',
488
        'Droid Serif',
489
        'Duru Sans',
490
        'Dynalight',
491
        'EB Garamond',
492
        'Eater',
493
        'Electrolize',
494
        'Emblema One',
495
        'Engagement',
496
        'Enriqueta',
497
        'Erica One',
498
        'Esteban',
499
        'Euphoria Script',
500
        'Ewert',
501
        'Exo',
502
        'Expletus Sans',
503
        'Fanwood Text',
504
        'Fascinate',
505
        'Fascinate Inline',
506
        'Federant',
507
        'Federo',
508
        'Felipa',
509
        'Fjord One',
510
        'Flamenco',
511
        'Flavors',
512
        'Fondamento',
513
        'Fontdiner Swanky',
514
        'Forum',
515
        'Francois One',
516
        'Fredericka the Great',
517
        'Freehand',
518
        'Fresca',
519
        'Frijole',
520
        'Fugaz One',
521
        'GFS Didot',
522
        'GFS Neohellenic',
523
        'Galdeano',
524
        'Gentium Basic',
525
        'Gentium Book Basic',
526
        'Geo',
527
        'Geostar',
528
        'Geostar Fill',
529
        'Germania One',
530
        'Give You Glory',
531
        'Glass Antiqua',
532
        'Glegoo',
533
        'Gloria Hallelujah',
534
        'Goblin One',
535
        'Gochi Hand',
536
        'Goudy Bookletter 1911',
537
        'Gravitas One',
538
        'Gruppo',
539
        'Gudea',
540
        'Habibi',
541
        'Hammersmith One',
542
        'Handlee',
543
        'Hanuman',
544
        'Henny Penny',
545
        'Herr Von Muellerhoff',
546
        'Holtwood One SC',
547
        'Homemade Apple',
548
        'Homenaje',
549
        'IM Fell DW Pica',
550
        'IM Fell DW Pica SC',
551
        'IM Fell Double Pica',
552
        'IM Fell Double Pica SC',
553
        'IM Fell English',
554
        'IM Fell English SC',
555
        'IM Fell French Canon',
556
        'IM Fell French Canon SC',
557
        'IM Fell Great Primer',
558
        'IM Fell Great Primer SC',
559
        'Iceberg',
560
        'Iceland',
561
        'Inconsolata',
562
        'Inder',
563
        'Indie Flower',
564
        'Inika',
565
        'Irish Grover',
566
        'Istok Web',
567
        'Italianno',
568
        'Jim Nightshade',
569
        'Jockey One',
570
        'Josefin Sans',
571
        'Josefin Slab',
572
        'Judson',
573
        'Julee',
574
        'Junge',
575
        'Jura',
576
        'Just Another Hand',
577
        'Just Me Again Down Here',
578
        'Kameron',
579
        'Kaushan Script',
580
        'Kelly Slab',
581
        'Kenia',
582
        'Khmer',
583
        'Knewave',
584
        'Kotta One',
585
        'Koulen',
586
        'Kranky',
587
        'Kreon',
588
        'Kristi',
589
        'Krona One',
590
        'La Belle Aurore',
591
        'Lancelot',
592
        'Lato',
593
        'League Script',
594
        'Leckerli One',
595
        'Ledger',
596
        'Lekton',
597
        'Lemon',
598
        'Lilita One',
599
        'Limelight',
600
        'Linden Hill',
601
        'Lobster',
602
        'Lobster Two',
603
        'Lora',
604
        'Love Ya Like A Sister',
605
        'Loved by the King',
606
        'Luckiest Guy',
607
        'Lusitana',
608
        'Lustria',
609
        'Macondo',
610
        'Macondo Swash Caps',
611
        'Magra',
612
        'Maiden Orange',
613
        'Mako',
614
        'Marck Script',
615
        'Marko One',
616
        'Marmelad',
617
        'Marvel',
618
        'Mate',
619
        'Mate SC',
620
        'Maven Pro',
621
        'Meddon',
622
        'MedievalSharp',
623
        'Medula One',
624
        'Megrim',
625
        'Merienda One',
626
        'Merriweather',
627
        'Metal',
628
        'Metamorphous',
629
        'Metrophobic',
630
        'Michroma',
631
        'Miltonian',
632
        'Miltonian Tattoo',
633
        'Miniver',
634
        'Miss Fajardose',
635
        'Modern Antiqua',
636
        'Molengo',
637
        'Monofett',
638
        'Monoton',
639
        'Monsieur La Doulaise',
640
        'Montaga',
641
        'Montez',
642
        'Montserrat',
643
        'Moul',
644
        'Moulpali',
645
        'Mountains of Christmas',
646
        'Mr Bedfort',
647
        'Mr Dafoe',
648
        'Mr De Haviland',
649
        'Mrs Saint Delafield',
650
        'Mrs Sheppards',
651
        'Muli',
652
        'Neucha',
653
        'Neuton',
654
        'News Cycle',
655
        'Niconne',
656
        'Nixie One',
657
        'Nobile',
658
        'Nokora',
659
        'Norican',
660
        'Nosifer',
661
        'Nothing You Could Do',
662
        'Noticia Text',
663
        'Nova Cut',
664
        'Nova Flat',
665
        'Nova Mono',
666
        'Nova Oval',
667
        'Nova Round',
668
        'Nova Script',
669
        'Nova Slim',
670
        'Nova Square',
671
        'Numans',
672
        'Nunito',
673
        'Odor Mean Chey',
674
        'Old Standard TT',
675
        'Oldenburg',
676
        'Open Sans',
677
        'Open Sans Condensed',
678
        'Orbitron',
679
        'Original Surfer',
680
        'Oswald',
681
        'Over the Rainbow',
682
        'Overlock',
683
        'Overlock SC',
684
        'Ovo',
685
        'PT Sans',
686
        'PT Sans Caption',
687
        'PT Sans Narrow',
688
        'PT Serif',
689
        'PT Serif Caption',
690
        'Pacifico',
691
        'Parisienne',
692
        'Passero One',
693
        'Passion One',
694
        'Patrick Hand',
695
        'Patua One',
696
        'Paytone One',
697
        'Permanent Marker',
698
        'Petrona',
699
        'Philosopher',
700
        'Piedra',
701
        'Pinyon Script',
702
        'Plaster',
703
        'Play',
704
        'Playball',
705
        'Playfair Display',
706
        'Podkova',
707
        'Poller One',
708
        'Poly',
709
        'Pompiere',
710
        'Port Lligat Sans',
711
        'Port Lligat Slab',
712
        'Prata',
713
        'Preahvihear',
714
        'Princess Sofia',
715
        'Prociono',
716
        'Puritan',
717
        'Quantico',
718
        'Quattrocento',
719
        'Quattrocento Sans',
720
        'Questrial',
721
        'Quicksand',
722
        'Qwigley',
723
        'Radley',
724
        'Raleway',
725
        'Rammetto One',
726
        'Rancho',
727
        'Rationale',
728
        'Redressed',
729
        'Reenie Beanie',
730
        'Ribeye',
731
        'Ribeye Marrow',
732
        'Righteous',
733
        'Rochester',
734
        'Rock Salt',
735
        'Rokkitt',
736
        'Ropa Sans',
737
        'Rosario',
738
        'Rouge Script',
739
        'Ruda',
740
        'Ruge Boogie',
741
        'Ruluko',
742
        'Ruslan Display',
743
        'Ruthie',
744
        'Sail',
745
        'Salsa',
746
        'Sancreek',
747
        'Sansita One',
748
        'Sarina',
749
        'Satisfy',
750
        'Schoolbell',
751
        'Sevillana',
752
        'Shadows Into Light',
753
        'Shadows Into Light Two',
754
        'Shanti',
755
        'Share',
756
        'Shojumaru',
757
        'Short Stack',
758
        'Siemreap',
759
        'Sigmar One',
760
        'Signika',
761
        'Signika Negative',
762
        'Sirin Stencil',
763
        'Six Caps',
764
        'Slackey',
765
        'Smokum',
766
        'Smythe',
767
        'Sniglet',
768
        'Snippet',
769
        'Sofia',
770
        'Sonsie One',
771
        'Sorts Mill Goudy',
772
        'Special Elite',
773
        'Spicy Rice',
774
        'Spinnaker',
775
        'Spirax',
776
        'Squada One',
777
        'Stardos Stencil',
778
        'Stint Ultra Condensed',
779
        'Stint Ultra Expanded',
780
        'Stoke',
781
        'Sue Ellen Francisco',
782
        'Sunshiney',
783
        'Supermercado One',
784
        'Suwannaphum',
785
        'Swanky and Moo Moo',
786
        'Syncopate',
787
        'Tangerine',
788
        'Taprom',
789
        'Telex',
790
        'Tenor Sans',
791
        'Terminal Dosis',
792
        'The Girl Next Door',
793
        'Tienne',
794
        'Tinos',
795
        'Titan One',
796
        'Trade Winds',
797
        'Trochut',
798
        'Trykker',
799
        'Tulpen One',
800
        'Ubuntu',
801
        'Ubuntu Condensed',
802
        'Ubuntu Mono',
803
        'Ultra',
804
        'Uncial Antiqua',
805
        'UnifrakturCook',
806
        'UnifrakturMaguntia',
807
        'Unkempt',
808
        'Unlock',
809
        'Unna',
810
        'VT323',
811
        'Varela',
812
        'Varela Round',
813
        'Vast Shadow',
814
        'Vibur',
815
        'Vidaloka',
816
        'Viga',
817
        'Voces',
818
        'Volkhov',
819
        'Vollkorn',
820
        'Voltaire',
821
        'Waiting for the Sunrise',
822
        'Wallpoet',
823
        'Walter Turncoat',
824
        'Wellfleet',
825
        'Wire One',
826
        'Yanone Kaffeesatz',
827
        'Yellowtail',
828
        'Yeseva One',
829
        'Yesteryear',
830
        'Zeyada',
831
      );
832
     // Cache this to the cache table.
833
     cache_set('at_google_font_names', $google_font_names_array, 'cache');
834
    }
835
  }
836

    
837
  return $google_font_names_array;
838
}
839

    
840
/**
841
 * Font size lists, hard coded for total control, used in forms.
842
 * While these values don't give super granular control over font scales they
843
 * are "good enough" for most users and provide a  useable tool that is easy to
844
 * understand.
845
 *
846
 * @param $type
847
 */
848
function font_sizes($type) {
849

    
850
  $font_sizes = &drupal_static(__FUNCTION__, array());
851
  switch ($type) {
852
    case ('em'):
853
      $font_sizes = array(
854
        '<none>' => 'Not set',
855
        '0.1em' => '0.1em',
856
        '0.2em' => '0.2em',
857
        '0.3em' => '0.3em',
858
        '0.4em' => '0.4em',
859
        '0.5em' => '0.5em',
860
        '0.6em' => '0.6em',
861
        '0.7em' => '0.7em',
862
        '0.8em' => '0.8em',
863
        '0.9em' => '0.9em',
864
        '1em'   => '1em',
865
        '1.1em' => '1.1em',
866
        '1.2em' => '1.2em',
867
        '1.3em' => '1.3em',
868
        '1.4em' => '1.4em',
869
        '1.5em' => '1.5em',
870
        '1.6em' => '1.6em',
871
        '1.7em' => '1.7em',
872
        '1.8em' => '1.8em',
873
        '1.9em' => '1.9em',
874
        '2em'   => '2em',
875
        '2.1em' => '2.1em',
876
        '2.2em' => '2.2em',
877
        '2.3em' => '2.3em',
878
        '2.4em' => '2.4em',
879
        '2.5em' => '2.5em',
880
        '2.6em' => '2.6em',
881
        '2.7em' => '2.7em',
882
        '2.8em' => '2.8em',
883
        '2.9em' => '2.9em',
884
        '3em'   => '3em',
885
        '3.1em' => '3.1em',
886
        '3.2em' => '3.2em',
887
        '3.3em' => '3.3em',
888
        '3.4em' => '3.4em',
889
        '3.5em' => '3.5em',
890
        '3.6em' => '3.6em',
891
        '3.7em' => '3.7em',
892
        '3.8em' => '3.8em',
893
        '3.9em' => '3.9em',
894
        '4em'   => '4em',
895
        '4.1em' => '4.1em',
896
        '4.2em' => '4.2em',
897
        '4.3em' => '4.3em',
898
        '4.4em' => '4.4em',
899
        '4.5em' => '4.5em',
900
        '4.6em' => '4.6em',
901
        '4.7em' => '4.7em',
902
        '4.8em' => '4.8em',
903
        '4.9em' => '4.9em',
904
        '5em'   => '5em',
905
        '5.1em' => '5.1em',
906
        '5.2em' => '5.2em',
907
        '5.3em' => '5.3em',
908
        '5.4em' => '5.4em',
909
        '5.5em' => '5.5em',
910
        '5.6em' => '5.6em',
911
        '5.7em' => '5.7em',
912
        '5.8em' => '5.8em',
913
        '5.9em' => '5.9em',
914
        '6em'   => '6em',
915
        '6.1em' => '6.1em',
916
        '6.2em' => '6.2em',
917
        '6.3em' => '6.3em',
918
        '6.4em' => '6.4em',
919
        '6.5em' => '6.5em',
920
        '6.6em' => '6.6em',
921
        '6.7em' => '6.7em',
922
        '6.8em' => '6.8em',
923
        '6.9em' => '6.9em',
924
        '7em'   => '7em',
925
      );
926
    break;
927
    case ('p'):
928
      $font_sizes = array(
929
        '<none>' => 'Not set',
930
        '62.5%'  => '62.5% (10px)',
931
        '68.8%'  => '68.8% (11px)',
932
        '75%'    => '75%   (12px)',
933
        '81.3%'  => '81.3% (13px)',
934
        '87.5%'  => '87.5% (14px)',
935
        '93.8%'  => '93.8% (15px)',
936
        '100%'   => '100%  (16px)',
937
      );
938
    break;
939
  }
940

    
941
  return $font_sizes;
942
}
943

    
944
/**
945
 * Return a list of line-heights.
946
 * Note this is not used by the core theme but could be used by a sub-theme
947
 * wanting to provide this feature.
948
 *
949
 * @param $type
950
 */
951
function line_heights($type) {
952

    
953
  $line_heights = &drupal_static(__FUNCTION__, array());
954
  switch ($type) {
955
    case ('unitless'):
956
      $line_heights = array(
957
        '<none>' => 'Not set',
958
        '0'   => '0',
959
        '0.1' => '0.1',
960
        '0.2' => '0.2',
961
        '0.3' => '0.3',
962
        '0.4' => '0.4',
963
        '0.5' => '0.5',
964
        '0.6' => '0.6',
965
        '0.7' => '0.7',
966
        '0.8' => '0.8',
967
        '0.9' => '0.9',
968
        '1'   => '1',
969
        '1.1' => '1.1',
970
        '1.2' => '1.2',
971
        '1.3' => '1.3',
972
        '1.4' => '1.4',
973
        '1.5' => '1.5',
974
        '1.6' => '1.6',
975
        '1.7' => '1.7',
976
        '1.8' => '1.8',
977
        '1.9' => '1.9',
978
        '2'   => '2',
979
        '2.1' => '2.1',
980
        '2.2' => '2.2',
981
        '2.3' => '2.3',
982
        '2.4' => '2.4',
983
        '2.5' => '2.5',
984
        '2.6' => '2.6',
985
        '2.7' => '2.7',
986
        '2.8' => '2.8',
987
        '2.9' => '2.9',
988
        '3'   => '3',
989
        '3.1' => '3.1',
990
        '3.2' => '3.2',
991
        '3.3' => '3.3',
992
        '3.4' => '3.4',
993
        '3.5' => '3.5',
994
        '3.6' => '3.6',
995
        '3.7' => '3.7',
996
        '3.8' => '3.8',
997
        '3.9' => '3.9',
998
        '4'   => '4',
999
        '4.1' => '4.1',
1000
        '4.2' => '4.2',
1001
        '4.3' => '4.3',
1002
        '4.4' => '4.4',
1003
        '4.5' => '4.5',
1004
        '4.6' => '4.6',
1005
        '4.7' => '4.7',
1006
        '4.8' => '4.8',
1007
        '4.9' => '4.9',
1008
        '5'   => '5',
1009
      );
1010
    break;
1011
  }
1012

    
1013
  return $line_heights;
1014
}
1015

    
1016
/**
1017
 * Reusable style options.
1018
 *
1019
 * @param $style
1020
 * @param $element
1021
 */
1022
function font_style_options($style, $element) {
1023
  $options = &drupal_static(__FUNCTION__, array());
1024
  switch ($style) {
1025
    case ('case'):
1026
      $options = array(
1027
        $element . 'c-n'  => t('Normal'),
1028
        $element . 'c-uc' => t('Upper case'),
1029
        $element . 'c-lc' => t('Lower case'),
1030
        $element . 'c-c'  => t('Capitalize'),
1031
        $element . 'c-sc' => t('Small caps'),
1032
      );
1033
    break;
1034
    case ('weight'):
1035
      $options = array(
1036
        $element . 'w-n' => t('Normal'),
1037
        $element . 'w-b' => t('Bold'),
1038
      );
1039
    break;
1040
    case ('alignment'):
1041
      $options = array(
1042
        $element . 'a-l' => t('Left'),
1043
        $element . 'a-r' => t('Right'),
1044
        $element . 'a-c' => t('Centered'),
1045
      );
1046
    break;
1047
    case ('shadow'):
1048
      $options = array(
1049
        $element . 's-n' => t('None'),
1050
        $element . 's-l' => t('Light'),
1051
        $element . 's-d' => t('Dark'),
1052
        $element . 's-w' => t('White'),
1053
      );
1054
    break;
1055
  }
1056

    
1057
  return $options;
1058
}