FileMaker WEBビューア オフラインでGoogle Material Icons を使う。

動作検証:
FileMaker Pro 19.5.4
Windows 10
macOS 12.5.1(intel)
iPadOS 15.6.1


## オンラインの場合
```:WEBビューア
"data:text/html;charset=UTF-8," & 
Let(~html=

"
<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='color-scheme' content='light dark'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <link href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet'>
</head>

<body>
{{body}}
</body>

</html>
"
;
	Substitute ( ~html 
	; ["{{body}}" ; MaterialIcons::body] 
	)
)
```

```html:フィールド: body
<i class='material-icons' style='color: #c70000;'>search</i>
<i class='material-icons' style='color: #d28300;'>home</i>
<i class='material-icons' style='color: #dfd000;'>menu</i>
<i class='material-icons' style='color: #00873c;'>close</i>
<i class='material-icons' style='color: #005aa0;'>settings</i>
<i class='material-icons' style='color: #181878;'>expand_more</i>
<i class='material-icons' style='color: #800073;'>done</i>
<i class='material-icons'>check_circle</i>
<i class='material-icons'>favorite</i>
<i class='material-icons'>add</i>
<i class='material-icons'>delete</i>
<i class='material-icons'>arrow_back</i>
<i class='material-icons'>star</i>
<i class='material-icons'>chevron_right</i>
<i class='material-icons'>arrow_forward_ios</i>
<i class='material-icons'>add_circle</i>
<i class='material-icons'>cancel</i>
<i class='material-icons'>arrow_back_ios</i>
<i class='material-icons'>file_download</i>
```

![Image 1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/703491/10091186-396e-a71d-f1bb-91aa47f2bb24.png)

## オフラインでGoogle Material Icons を使う。

https://fonts.googleapis.com/icon?family=Material+Icons へアクセス。

![Image 2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/703491/cd03c09f-36f8-8a04-0658-a4a429483504.png)

https://fonts.gstatic.com/s/materialicons/v139/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 をダウンロード。

ファイル名を「material-icons.woff2」として保存。

FileMaker
フィールド: material-icons.woff2｜タイプ: オブジェクト

フィールド: material-icons.woff2 に先程ダウンロードした「material-icons.woff2」を挿入

![Image 3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/703491/ba9e15f2-961e-180e-f443-7b924b3cf30e.png)

### WEBビューア オフライン用

```
src: url(https://fonts.gstatic.com/s/materialicons/v139/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
//↓BASE64で読み込むようにする
src: url(data:font/woff2;base64,{{material_icons.woff2}}) format('woff2');
```

`{{material_icons.woff2}}` を 
`Base64EncodeRFC ( 3548 ; MaterialIcons::material_icons.woff2 )` で置換


![Image 4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/703491/e5475984-2f39-768e-5ca8-92b7ba03ed16.png)

```:WEBビューア
"data:text/html;charset=UTF-8," & 
Let(~html=

"
<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='color-scheme' content='light dark'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <style>
/* fallback */
@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(data:font/woff2;base64,{{material_icons.woff2}}) format('woff2');
}

.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}
    </style>
</head>

<body>
{{body}}
</body>

</html>
"
;
	Substitute ( ~html 
	; ["{{material_icons.woff2}}" ; Base64EncodeRFC ( 3548 ; MaterialIcons::material_icons.woff2 )] 
	; ["{{body}}" ; MaterialIcons::body] 
	)
)
```

![Image 5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/703491/09e870f7-3854-d1ff-47ed-a661d288b665.png)

Outlined,Round,Sharp,Two+Tone を使いたい場合は、以下を参考にして追加。

https://developers.google.com/fonts/docs/material_icons


https://fonts.googleapis.com/css2?family=Material+Icons
https://fonts.googleapis.com/css2?family=Material+Icons+Outlined
https://fonts.googleapis.com/css2?family=Material+Icons+Round
https://fonts.googleapis.com/css2?family=Material+Icons+Sharp
https://fonts.googleapis.com/css2?family=Material+Icons+Two+Tone