Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / file_mdm / file_mdm_font / README.md
1 # File metadata Font
2
3 A Drupal 8 module providing a file metadata plugin to retrieve information from
4 font files.
5
6
7 ## Features:
8
9 Uses the [PHP Font Lib](https://github.com/PhenX/php-font-lib) to read font
10 information from TTF/OTF/WOFF font files.
11
12
13 ## Usage examples:
14
15 1. Use the _file_metadata_manager_ service to prepare collecting metadata for
16    the font located at a desired URI:
17
18   ```php
19     $fmdm = \Drupal::service('file_metadata_manager');
20     $my_font_metadata = $fmdm->uri('public::/my_font_directory/arial.ttf');
21     ...
22   ```
23
24 2. Get the value of a key:
25
26   ```php
27     ...
28     $font_name = $my_font_metadata->getMetadata('font', 'FontName');
29     ...
30   ```
31
32 3. Get an array with all the metadata values:
33
34   ```php
35     ...
36     $my_font_info = [];
37     foreach ($my_font_metadata->getSupportedKeys('font') as $key) {
38       $my_font_info[$key] = $my_font_metadata->getMetadata('font', $key);
39     }
40     ...
41   ```
42
43
44 ## Available metadata keys:
45
46 Key                 |
47 --------------------|
48 FontType            |
49 FontWeight          |
50 Copyright           |
51 FontName            |
52 FontSubfamily       |
53 UniqueID            |
54 FullName            |
55 Version             |
56 PostScriptName      |
57 Trademark           |
58 Manufacturer        |
59 Designer            |
60 Description         |
61 FontVendorURL       |
62 FontDesignerURL     |
63 LicenseDescription  |
64 LicenseURL          |
65 PreferredFamily     |
66 PreferredSubfamily  |
67 CompatibleFullName  |
68 SampleText          |