2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

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

Last updated at Posted at 2022-09-26

動作検証:
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] 
	)
)
フィールド: 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

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

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

Image 2.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

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

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

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

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

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?