upd README + SEO preview selection template (#237)
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
DOCS_PATH=$(realpath $SCRIPT_DIR/../qdrant-landing/content/documentation)
|
||||
|
||||
|
||||
find $DOCS_PATH -name '*.md' | xargs -I {} bash ${SCRIPT_DIR}/generate-doc-preview.sh {}
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
PATH_TO_DOC=${1:-""}
|
||||
|
||||
if [ -z "$PATH_TO_DOC" ]; then
|
||||
echo "No path to doc provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
PATH_TO_DOCS=$(realpath $SCRIPT_DIR/../qdrant-landing/content/documentation)
|
||||
|
||||
PATH_TO_IMAGES=$(realpath $SCRIPT_DIR/../qdrant-landing/static/documentation)
|
||||
|
||||
ABS_DOCS_DIR=$(realpath $PATH_TO_DOCS)
|
||||
ABS_DOC_DIR=$(dirname $(realpath $PATH_TO_DOC))
|
||||
|
||||
|
||||
DOCS_RELATIVE_PATH=$(realpath --relative-to=$ABS_DOCS_DIR $ABS_DOC_DIR)
|
||||
|
||||
DOC_FILE_NAME=$(basename $PATH_TO_DOC)
|
||||
|
||||
DOC_NAME_WITHOUT_EXTENSION=${DOC_FILE_NAME%.*}
|
||||
|
||||
export OUTPUT_PATH="$PATH_TO_IMAGES/${DOCS_RELATIVE_PATH}/${DOC_NAME_WITHOUT_EXTENSION}-social-preview.png"
|
||||
|
||||
if [ -f "$OUTPUT_PATH" ]; then
|
||||
echo "Preview already exists"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Check if the doc is in the docs directory
|
||||
if [ "$DOCS_RELATIVE_PATH" == "." ]; then
|
||||
SUBTITLE_TEXT="Documentation"
|
||||
else
|
||||
if [ "$DOC_NAME_WITHOUT_EXTENSION" == "_index" ]; then
|
||||
SUBTITLE_TEXT="Documentation"
|
||||
else
|
||||
SUBSECTION_TITLE=$(cat $ABS_DOC_DIR/_index.md | grep "title:" | head -n 1 | sed 's/title: //g' | sed 's/"//g')
|
||||
SUBTITLE_TEXT="Documentation / $SUBSECTION_TITLE"
|
||||
fi
|
||||
fi
|
||||
|
||||
TITLE_TEXT=$(cat $PATH_TO_DOC | grep "title:" | head -n 1 | sed 's/title: //g' | sed 's/"//g')
|
||||
|
||||
echo $SUBTITLE_TEXT
|
||||
echo $TITLE_TEXT
|
||||
|
||||
PATH_TO_BG_IMAGE="${PATH_TO_IMAGES}/${DOCS_RELATIVE_PATH}/${DOC_NAME_WITHOUT_EXTENSION}-bg.png"
|
||||
|
||||
if [ -f "$PATH_TO_BG_IMAGE" ]; then
|
||||
BACKGROUND_PATH="$PATH_TO_BG_IMAGE"
|
||||
else
|
||||
BACKGROUND_PATH=""
|
||||
fi
|
||||
|
||||
mkdir -p $PATH_TO_IMAGES/${DOCS_RELATIVE_PATH}
|
||||
|
||||
export TITLE_TEXT="$TITLE_TEXT"
|
||||
export SUBTITLE_TEXT="$SUBTITLE_TEXT"
|
||||
export BACKGROUND_PATH="$BACKGROUND_PATH"
|
||||
|
||||
bash $SCRIPT_DIR/template/apply-template.sh
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path to the directory where the script is located
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
OUTPUT_PATH=${OUTPUT_PATH:-"$SCRIPT_DIR/output.png"}
|
||||
|
||||
export MAGICK_FONT_PATH=$SCRIPT_DIR/fonts
|
||||
|
||||
SUBTITLE_TEXT=${SUBTITLE_TEXT:-""}
|
||||
|
||||
if [ -z "$SUBTITLE_TEXT" ]; then
|
||||
echo "No subtitle text provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TITLE_TEXT=${TITLE_TEXT:-""}
|
||||
|
||||
if [ -z "$TITLE_TEXT" ]; then
|
||||
echo "No title text provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SUBTITLE_TEXT_COMMAND="text 64,239 '$SUBTITLE_TEXT'"
|
||||
SUBTITLE_SIZE=48
|
||||
|
||||
BACKGROUND_PATH=${BACKGROUND_PATH:-""}
|
||||
|
||||
if [ -z "$BACKGROUND_PATH" ]; then
|
||||
|
||||
BACKGROUNDS=(a b c d e f g h i j k)
|
||||
|
||||
RANDOM_BACKGROUND=${BACKGROUNDS[$RANDOM % ${#BACKGROUNDS[@]} ]}
|
||||
|
||||
TEMPLATE_PATH="$SCRIPT_DIR/backgrounds/bg_${RANDOM_BACKGROUND}.png"
|
||||
|
||||
convert $TEMPLATE_PATH -font "RobotoMonoM" -fill '#F2F6FF' -density 72 -pointsize $SUBTITLE_SIZE -draw "$SUBTITLE_TEXT_COMMAND" $OUTPUT_PATH
|
||||
|
||||
convert $OUTPUT_PATH \
|
||||
-interline-spacing 0 \
|
||||
-font "RobotoB" \
|
||||
-fill '#F2F6FF' \
|
||||
-size 640x \
|
||||
-density 72 \
|
||||
-pointsize 80 \
|
||||
-background none \
|
||||
caption:"$TITLE_TEXT" \
|
||||
-geometry '+64+280' \
|
||||
-composite \
|
||||
$OUTPUT_PATH
|
||||
else
|
||||
TEMPLATE_PATH="$SCRIPT_DIR/backgrounds/empty.png"
|
||||
|
||||
echo $MAGICK_FONT_PATH
|
||||
|
||||
convert $TEMPLATE_PATH -font "RobotoMonoM" -fill '#F2F6FF' -density 72 -pointsize $SUBTITLE_SIZE -draw "$SUBTITLE_TEXT_COMMAND" $OUTPUT_PATH
|
||||
|
||||
convert $OUTPUT_PATH \
|
||||
-interline-spacing 0 \
|
||||
-font "RobotoB" \
|
||||
-fill '#F2F6FF' \
|
||||
-size 640x \
|
||||
-density 72 \
|
||||
-pointsize 80 \
|
||||
-background none \
|
||||
caption:"$TITLE_TEXT" \
|
||||
-geometry '+64+280' \
|
||||
-composite \
|
||||
$OUTPUT_PATH
|
||||
|
||||
convert $BACKGROUND_PATH $OUTPUT_PATH -gravity center -resize '1280x640' -composite $OUTPUT_PATH
|
||||
fi
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 611 KiB |
|
After Width: | Height: | Size: 600 KiB |
|
After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 653 KiB |
|
After Width: | Height: | Size: 643 KiB |
|
After Width: | Height: | Size: 666 KiB |
|
After Width: | Height: | Size: 605 KiB |
|
After Width: | Height: | Size: 626 KiB |
|
After Width: | Height: | Size: 608 KiB |
|
After Width: | Height: | Size: 604 KiB |
|
After Width: | Height: | Size: 588 KiB |
|
After Width: | Height: | Size: 832 KiB |
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,77 @@
|
||||
Roboto Mono Variable Font
|
||||
=========================
|
||||
|
||||
This download contains Roboto Mono as both variable fonts and static fonts.
|
||||
|
||||
Roboto Mono is a variable font with this axis:
|
||||
wght
|
||||
|
||||
This means all the styles are contained in these files:
|
||||
RobotoMono-VariableFont_wght.ttf
|
||||
RobotoMono-Italic-VariableFont_wght.ttf
|
||||
|
||||
If your app fully supports variable fonts, you can now pick intermediate styles
|
||||
that aren’t available as static fonts. Not all apps support variable fonts, and
|
||||
in those cases you can use the static font files for Roboto Mono:
|
||||
static/RobotoMono-Thin.ttf
|
||||
static/RobotoMono-ExtraLight.ttf
|
||||
static/RobotoMono-Light.ttf
|
||||
static/RobotoMono-Regular.ttf
|
||||
static/RobotoMono-Medium.ttf
|
||||
static/RobotoMono-SemiBold.ttf
|
||||
static/RobotoMono-Bold.ttf
|
||||
static/RobotoMono-ThinItalic.ttf
|
||||
static/RobotoMono-ExtraLightItalic.ttf
|
||||
static/RobotoMono-LightItalic.ttf
|
||||
static/RobotoMono-Italic.ttf
|
||||
static/RobotoMono-MediumItalic.ttf
|
||||
static/RobotoMono-SemiBoldItalic.ttf
|
||||
static/RobotoMono-BoldItalic.ttf
|
||||
|
||||
Get started
|
||||
-----------
|
||||
|
||||
1. Install the font files you want to use
|
||||
|
||||
2. Use your app's font picker to view the font family and all the
|
||||
available styles
|
||||
|
||||
Learn more about variable fonts
|
||||
-------------------------------
|
||||
|
||||
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
|
||||
https://variablefonts.typenetwork.com
|
||||
https://medium.com/variable-fonts
|
||||
|
||||
In desktop apps
|
||||
|
||||
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
|
||||
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
|
||||
|
||||
Online
|
||||
|
||||
https://developers.google.com/fonts/docs/getting_started
|
||||
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
|
||||
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
|
||||
|
||||
Installing fonts
|
||||
|
||||
MacOS: https://support.apple.com/en-us/HT201749
|
||||
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
|
||||
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
|
||||
|
||||
Android Apps
|
||||
|
||||
https://developers.google.com/fonts/docs/android
|
||||
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
|
||||
|
||||
License
|
||||
-------
|
||||
Please read the full license text (LICENSE.txt) to understand the permissions,
|
||||
restrictions and requirements for usage, redistribution, and modification.
|
||||
|
||||
You can use them in your products & projects – print or digital,
|
||||
commercial or otherwise.
|
||||
|
||||
This isn't legal advice, please consider consulting a lawyer and see the full
|
||||
license for all details.
|
||||
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0"?>
|
||||
<typemap>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoBI"
|
||||
fullname="Roboto Bold Italic"
|
||||
family="Roboto"
|
||||
glyphs="./Roboto-BoldItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoB"
|
||||
fullname="Roboto Bold"
|
||||
family="Roboto"
|
||||
glyphs="./Roboto-Bold.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoThin"
|
||||
fullname="Roboto Thin"
|
||||
family="Roboto Thin"
|
||||
glyphs="./Roboto-Thin.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoLI"
|
||||
fullname="Roboto Light Italic"
|
||||
family="Roboto Light"
|
||||
glyphs="./Roboto-LightItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMono"
|
||||
fullname="Roboto Mono Regular"
|
||||
family="Roboto Mono"
|
||||
glyphs="./RobotoMono-VariableFont_wght.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoThinI"
|
||||
fullname="Roboto Thin Italic"
|
||||
family="Roboto Thin"
|
||||
glyphs="./Roboto-ThinItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMI"
|
||||
fullname="Roboto Medium Italic"
|
||||
family="Roboto Medium"
|
||||
glyphs="./Roboto-MediumItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="Roboto"
|
||||
fullname="Roboto"
|
||||
family="Roboto"
|
||||
glyphs="./Roboto-Regular.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoM"
|
||||
fullname="Roboto Medium"
|
||||
family="Roboto Medium"
|
||||
glyphs="./Roboto-Medium.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoI"
|
||||
fullname="Roboto Italic"
|
||||
family="Roboto"
|
||||
glyphs="./Roboto-Italic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoL"
|
||||
fullname="Roboto Light"
|
||||
family="Roboto Light"
|
||||
glyphs="./Roboto-Light.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoBI"
|
||||
fullname="Roboto Mono Bold Italic"
|
||||
family="Roboto Mono"
|
||||
glyphs="./static/RobotoMono-BoldItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoThin"
|
||||
fullname="Roboto Mono Thin"
|
||||
family="Roboto Mono Thin"
|
||||
glyphs="./static/RobotoMono-Thin.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoM"
|
||||
fullname="Roboto Mono Medium"
|
||||
family="Roboto Mono Medium"
|
||||
glyphs="./static/RobotoMono-Medium.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoMI"
|
||||
fullname="Roboto Mono Medium Italic"
|
||||
family="Roboto Mono Medium"
|
||||
glyphs="./static/RobotoMono-MediumItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoLI"
|
||||
fullname="Roboto Mono Light Italic"
|
||||
family="Roboto Mono Light"
|
||||
glyphs="./static/RobotoMono-LightItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoSemiBold"
|
||||
fullname="Roboto Mono SemiBold"
|
||||
family="Roboto Mono SemiBold"
|
||||
glyphs="./static/RobotoMono-SemiBold.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoExtraLight"
|
||||
fullname="Roboto Mono ExtraLight"
|
||||
family="Roboto Mono ExtraLight"
|
||||
glyphs="./static/RobotoMono-ExtraLight.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoI"
|
||||
fullname="Roboto Mono Italic"
|
||||
family="Roboto Mono"
|
||||
glyphs="./static/RobotoMono-Italic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoExtraLightI"
|
||||
fullname="Roboto Mono ExtraLight Italic"
|
||||
family="Roboto Mono ExtraLight"
|
||||
glyphs="./static/RobotoMono-ExtraLightItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoL"
|
||||
fullname="Roboto Mono Light"
|
||||
family="Roboto Mono Light"
|
||||
glyphs="./static/RobotoMono-Light.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoSemiBoldI"
|
||||
fullname="Roboto Mono SemiBold Italic"
|
||||
family="Roboto Mono SemiBold"
|
||||
glyphs="./static/RobotoMono-SemiBoldItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMono"
|
||||
fullname="Roboto Mono Regular"
|
||||
family="Roboto Mono"
|
||||
glyphs="./static/RobotoMono-Regular.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoThinI"
|
||||
fullname="Roboto Mono Thin Italic"
|
||||
family="Roboto Mono Thin"
|
||||
glyphs="./static/RobotoMono-ThinItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoB"
|
||||
fullname="Roboto Mono Bold"
|
||||
family="Roboto Mono"
|
||||
glyphs="./static/RobotoMono-Bold.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoMonoI"
|
||||
fullname="Roboto Mono Italic"
|
||||
family="Roboto Mono"
|
||||
glyphs="./RobotoMono-Italic-VariableFont_wght.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoBkI"
|
||||
fullname="Roboto Black Italic"
|
||||
family="Roboto Black"
|
||||
glyphs="./Roboto-BlackItalic.ttf"
|
||||
/>
|
||||
|
||||
<type
|
||||
format="ttf"
|
||||
name="RobotoBk"
|
||||
fullname="Roboto Black"
|
||||
family="Roboto Black"
|
||||
glyphs="./Roboto-Black.ttf"
|
||||
/>
|
||||
|
||||
</typemap>
|
||||
@@ -0,0 +1,555 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Usage: $prog > ~/.magick/type.xml
|
||||
# $prog [-d] font1.ttf font2.ttf ... > type.xml
|
||||
# $prog -f ttf_font_file_list > type.xml
|
||||
#
|
||||
# Generate an ImageMagick font list "type.xml" file for ALL fonts
|
||||
# currently on the local linux system. This includes
|
||||
# True Type Fonts (ttf)
|
||||
# Open Type Fonts (otf)
|
||||
# Ghostscript Adobe Fonts (afm)
|
||||
#
|
||||
# The output can be saved into files in the ".magick" sub-directory of
|
||||
# your home, to be referenced by, or replacing the "type.xml" file.
|
||||
#
|
||||
# This file informs ImageMagick of the fonts location, font type, name and
|
||||
# family. It also trys its best to clean up the name to provide a 'nicer'
|
||||
# one for you to magick identify the various fonts.
|
||||
#
|
||||
# On Linux system the scritp uses the "locate" command to find the fonts.
|
||||
# If you recently added fonts you should run "updatedb" first.
|
||||
#
|
||||
# On MacOSX only the fonts stored in /Library/Fonts are looked for.
|
||||
# That is the script is equivelent to doing...
|
||||
#
|
||||
# find /Library/Fonts -type f -name '*.*' | \
|
||||
# imagick_type_gen -f - > type.xml
|
||||
#
|
||||
# When the "type.xml" font definitions file has been generated and
|
||||
# installed, should then see a list of the fonts found with...
|
||||
# magick -list font
|
||||
#
|
||||
# And can use the fonts, by name, with commands like...
|
||||
# magick -font Candice -pointsize 72 label:Anthony x:
|
||||
#
|
||||
# Instead of having to specifying TTF font file directly...
|
||||
# magick -font ~/lib/font/truetype/favoriate/candice.ttf \
|
||||
# -pointsize 72 label:Anthony x:
|
||||
#
|
||||
# Also see the script "show_fonts" which displays a sample image either
|
||||
# a IM defined font, or the given font files. The "graphics_utf" script
|
||||
# may also be useful to look at specific UTF character sections of a
|
||||
# specific font, such as Math symbols.
|
||||
#
|
||||
# Anthony Thyssen May 2003 - Updated Feburary 2017
|
||||
#
|
||||
###
|
||||
#
|
||||
# Example use, seperating system from personal fonts so the later
|
||||
# overrides the former (of the same font exists)
|
||||
#
|
||||
# For example...
|
||||
#
|
||||
# # Find personal fonts
|
||||
# find $HOME/fonts -type f -name '*.ttf' | \
|
||||
# imagick_type_gen -f - > ~/.magick/type-myfonts.xml
|
||||
#
|
||||
# # Find System Fonts - then remove personal fonts from that list
|
||||
# sudo updatedb
|
||||
# imagick_type_gen > ~/.magick/type-system.xml
|
||||
# perl -00 -i -ne "m%glyphs=\"$HOME/% || print" ~/.magick/type-system.xml
|
||||
#
|
||||
# You can then include both of these files into a "~/.magick/type.xml"
|
||||
# so that the person
|
||||
#
|
||||
# <typemap>
|
||||
# <include file="type-system.xml" />
|
||||
# <include file="type-myfonts.xml" />
|
||||
# </typemap>
|
||||
#
|
||||
# Note that later defintions will override earlier ones. As such "myfonts"
|
||||
# will override any "system" font. However any fonts that the IM system
|
||||
# configures in /usr/lib/ImageMagick-*/config/type*.xml will override the
|
||||
# both the above definitions, though that is unlikely.
|
||||
#
|
||||
###
|
||||
# Internal Notes and History
|
||||
#
|
||||
# Primary Source
|
||||
# http://www.imagemagick.org/Usage/scripts/imagick_type_gen
|
||||
#
|
||||
# Originally the script used an external tool to read TTF fonts, but now
|
||||
# that is built-in thanks to Peter N Lewis <peter@stairways.com.au>
|
||||
#
|
||||
# Before IM v6.1.2-3 the font list file was called "type.mgk" and
|
||||
# not "type.xml". And you would use "-list type" instead of "-list font"
|
||||
#
|
||||
# The original version of this script was found on
|
||||
# http://studio.imagemagick.org/pipermail/magick-users/2003-March/001703.html
|
||||
# by raptor <raptor@unacs.bg>, presumaibly around March 2002
|
||||
#
|
||||
# Re-Write by Anthony Thyssen <anthony@cit.griffith.edu.au>, August 2002
|
||||
# May 2003 Update with TTF family names
|
||||
# Oct 2005 Update to use "getttinfo" if available
|
||||
# Jan 2009 updated
|
||||
# Feb 2017 merge bug report from Kazuyoshi Tlacaelel <kazu.dev@gmail.com>
|
||||
#
|
||||
# WARNING: Input arguments are NOT tested for correctness.
|
||||
# This script represents a security risk if used ONLINE.
|
||||
# I accept no responsiblity for misuse. Use at own risk.
|
||||
#
|
||||
###
|
||||
use strict;
|
||||
use FindBin;
|
||||
my $PROGNAME = $FindBin::Script;
|
||||
use Fcntl qw( O_RDONLY SEEK_SET );
|
||||
binmode(STDOUT, ":utf8");
|
||||
binmode(STDERR, ":utf8");
|
||||
|
||||
my $VERBOSE = 0; # verbose output of fonts found
|
||||
my $DEBUG = 0; # debug TTF file decoding
|
||||
my $FILE = 0; # read a font list from a file (maybe stdin)
|
||||
|
||||
# ======================================================================
|
||||
# Font Handling...
|
||||
# ======================================================================
|
||||
#
|
||||
# True Type fonts Handling
|
||||
#
|
||||
my $ttf_template = herefile( q{
|
||||
| <type
|
||||
| format="ttf"
|
||||
| name="%s"
|
||||
| glyphs="%s"
|
||||
| />
|
||||
});
|
||||
my $ttf_template_full = herefile( q{
|
||||
| <type
|
||||
| format="ttf"
|
||||
| name="%s"
|
||||
| fullname="%s"
|
||||
| family="%s"
|
||||
| glyphs="%s"
|
||||
| />
|
||||
});
|
||||
|
||||
sub ttf_file_parse {
|
||||
#
|
||||
# Method for Parsing TTF files curtesy of
|
||||
# Peter N Lewis <peter@stairways.com.au>
|
||||
#
|
||||
my $file = $_[0];
|
||||
my ( $font_family, $font_fullname, $font_psname ) = ( '','','','' );
|
||||
|
||||
my ( $fh, $len );
|
||||
unless ( sysopen( $fh, $file, O_RDONLY ) ) {
|
||||
warn "Cannot open $file: $!\n";
|
||||
return;
|
||||
}
|
||||
my $header;
|
||||
unless ( sysread( $fh, $header, 12 ) ) {
|
||||
warn "Cant read header: $file";
|
||||
close($fh);
|
||||
return;
|
||||
}
|
||||
my ( $sfnt_version, $numTables, $searchRange, $entrySelector, $rangeShift
|
||||
) = unpack( 'Nnnnn', $header );
|
||||
|
||||
my $sfnt_version_code = unpack( 'A4', $header );
|
||||
unless ( $sfnt_version == 0x00010000
|
||||
|| $sfnt_version_code eq 'true'
|
||||
|| $sfnt_version_code eq 'typ1' ) {
|
||||
warn "TTF Version mismatch, not a basic TrueType font file: $file";
|
||||
close($fh);
|
||||
return;
|
||||
}
|
||||
|
||||
print STDERR "TTF Table count: $numTables\n" if $DEBUG>=2;
|
||||
foreach ( 1..$numTables ) {
|
||||
my $table_entry;
|
||||
unless ( sysread( $fh, $table_entry, 16 ) ) {
|
||||
warn "Cant read master table $_ from $file";
|
||||
last;
|
||||
}
|
||||
|
||||
my ( $table_tag, $table_checkSum, $table_offset, $table_length
|
||||
) = unpack( 'A4NNN', $table_entry );
|
||||
print STDERR "Table: $table_tag\n" if $DEBUG>=2;
|
||||
$table_tag eq 'name' or next;
|
||||
|
||||
my $table_header;
|
||||
sysseek( $fh, $table_offset, SEEK_SET ) or die "Can't seek: $file";
|
||||
sysread( $fh, $table_header, 6 );
|
||||
my ( $table_format, $table_count, $table_stringOffset
|
||||
) = unpack( 'nnn', $table_header );
|
||||
print STDERR "Name Table Entries: $table_count\n" if $DEBUG>=2;
|
||||
my $table_base = $table_offset + 6;
|
||||
my $storage_base = $table_base + $table_count * 12;
|
||||
|
||||
foreach my $index ( 1..$table_count ) {
|
||||
my $entry;
|
||||
sysseek( $fh, $table_base + ($index-1)*12, SEEK_SET )
|
||||
or die "Cant seek: $file";
|
||||
sysread( $fh, $entry, 12 );
|
||||
my ( $name_platformID, $name_encodingID, $name_languageID,
|
||||
$name_id, $name_length, $name_offset
|
||||
) = unpack( 'nnnnnn', $entry );
|
||||
print STDERR "Index[$index]: ", join ( ", ",
|
||||
$name_platformID, $name_encodingID, $name_languageID,
|
||||
$name_id, $name_length, $name_offset ), "\n" if $DEBUG>=2;
|
||||
#
|
||||
# ID meanings : figured out from getttinfo
|
||||
#
|
||||
# Platform: 0=Apple 1=macintosh 3=microsoft
|
||||
# Encoding: 0=unicode(8) 1=unicode(16)
|
||||
# Language: 0=english 1033=English-US 1041=Japanese 2052=Chinese
|
||||
#
|
||||
next unless $name_languageID == 0
|
||||
|| $name_languageID == 1033
|
||||
;
|
||||
|
||||
my $name;
|
||||
sysseek( $fh, $storage_base + $name_offset, SEEK_SET )
|
||||
or die "Cant seek: $file";
|
||||
sysread( $fh, $name, $name_length );
|
||||
|
||||
# Decode UTF-16 to UTF-8 if nessary
|
||||
$name = pack("U*",unpack("n*", $name)) if $name_encodingID == 1;
|
||||
$name =~ s/\0//g; # clean fonts use UTF-16 when it should be UTF-8
|
||||
print STDERR "$name\n" if $DEBUG>=2;
|
||||
|
||||
$font_family = $name if $name_id == 1;
|
||||
#font_subfamily = $name if $name_id == 2; # (EG: Regular)
|
||||
#font_identifier = $name if $name_id == 3; # Unique Name
|
||||
$font_fullname = $name if $name_id == 4;
|
||||
#font_version = $name if $name_id == 5;
|
||||
$font_psname = $name if $name_id == 6; # Postscipt Name
|
||||
#font_trademark = $name if $name_id == 7;
|
||||
#font_manufacturer = $name if $name_id == 8;
|
||||
#font_designer = $name if $name_id == 9;
|
||||
}
|
||||
last; # found "name" table -- skip any other tables as irrelevent
|
||||
}
|
||||
close( $fh );
|
||||
return ( $font_family, $font_fullname, $font_psname );
|
||||
}
|
||||
|
||||
sub ttf_name {
|
||||
my $file = shift;
|
||||
|
||||
my ( $family, $fullname, $psname ) = &ttf_file_parse( $file );
|
||||
print STDERR "$file\n\t==> $family -- $fullname -- $psname\n" if $DEBUG;
|
||||
|
||||
$fullname =~ s/[^\s\w-]//g; # Check: Pepsi.ttf
|
||||
$fullname =~ s/^\s+//;
|
||||
$fullname =~ s/\s+$//;
|
||||
$fullname =~ s/(^|\s)-/$1/g;
|
||||
$fullname =~ s/-(\s|$)/$1/g;
|
||||
|
||||
$family =~ s/[^\s\w-]//g; # Check: Pepsi.ttf
|
||||
$family =~ s/^\s*//;
|
||||
$family =~ s/\s*$//;
|
||||
$family =~ s/\s*(MS|ITC)$//; # font factory ititials
|
||||
$family =~ s/^(MS|ITC)\s*//;
|
||||
$family =~ s/\s*(FB|MT)\s*/ /; # Check: MaturaScriptCapitals
|
||||
$family =~ s/^Monotype\s*//; # Check: Corsiva
|
||||
$family =~ s/^AR PL\s*//; # Check: gkai00mp.ttf
|
||||
$family =~ s/\sBV$//; # Check: CandyStore.ttf
|
||||
|
||||
# Determine simple font name
|
||||
# Junk/abbr decriptive strings, foundaries, etc
|
||||
# Test with the fonts given
|
||||
my $name = ($fullname);
|
||||
$name =~ s/-/ /g;
|
||||
$name =~ s/\s*(MS|ITC)$//; # font factory ititials
|
||||
$name =~ s/^(MS|ITC)\s*//;
|
||||
$name =~ s/\s*(FB|MT)\s*/ /; # Check: MaturaScriptCapitals
|
||||
$name =~ s/^Monotype\s*//; # Check: Corsiva
|
||||
$name =~ s/^AR PL\s*//; # Check: gkai00mp.ttf
|
||||
$name =~ s/^TTF_//; # Check: TattoEF.tff
|
||||
$name =~ s/^HE_//; # Check: Terminal.tff
|
||||
$name =~ s/^KR\s//; # Check: SimpleFleur*.ttf
|
||||
$name =~ s/\sBT$//; # Check: Amazone.ttf
|
||||
$name =~ s/\sBV$//; # Check: CandyStore.ttf
|
||||
$name =~ s/\sFM$//; # Check: CactusSandwich.ttf
|
||||
$name =~ s/\sNFI$//; # Check: Zreaks.ttf
|
||||
$name =~ s/SSK$//; # Check: BravoScript.ttf
|
||||
|
||||
$name =~ s/Regular//g; # Check: Gecko
|
||||
$name =~ s/\bPlain\b//g; # Check: LittleGidding
|
||||
$name =~ s/\bReg\b//g; # Check: agencyr.ttf
|
||||
$name =~ s/\bNormal\b//g;
|
||||
#$name =~ s/\bSans\b//g;
|
||||
$name =~ s/\bDemi\s*[Bb]old\b/Db/g;
|
||||
$name =~ s/\bCondensed\b/C/g;
|
||||
$name =~ s/\bBold\b/B/g;
|
||||
$name =~ s/\bItalic\b/I/g;
|
||||
$name =~ s/\bExtra[Bb]old\b/Xb/g;
|
||||
$name =~ s/\bBlack\b/Bk/g;
|
||||
$name =~ s/\bHeavy\b/H/g;
|
||||
$name =~ s/\bMedium\b/M/g; # Check: gkai00mp.ttf
|
||||
$name =~ s/\bLight\b/L/g;
|
||||
$name =~ s/\bOblique\b/Ob/g;
|
||||
$name =~ s/\bUnregistered\b//g; # Check: CandyCane.ttf
|
||||
|
||||
$name =~ s/\s+//g; # Remove all spaces
|
||||
|
||||
# Special Case Renaming
|
||||
$name = "Dot" if $name eq "NationalFirstFontDotted";
|
||||
|
||||
$fullname =~ s/\s+/ /g;
|
||||
$fullname =~ s/\s$//;
|
||||
$fullname =~ s/^\s//;
|
||||
|
||||
# Failed to parse TTF file?
|
||||
return( ( $file =~ m/^.*\/(.*?).ttf$/ )[0] ) unless $name;
|
||||
|
||||
return ($name, $fullname, $family); # return the name if found!
|
||||
}
|
||||
|
||||
sub do_ttf_font {
|
||||
my $file = shift;
|
||||
my (@ttf) = ttf_name($file);
|
||||
|
||||
print STDERR join( ' - ', @ttf), "\n" if $VERBOSE;
|
||||
printf $ttf_template, @ttf, $file if @ttf == 1;
|
||||
printf $ttf_template_full, @ttf, $file if @ttf == 3;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------
|
||||
#
|
||||
# Open Type fonts
|
||||
#
|
||||
# I do not know how to parse OTF files (yet)
|
||||
# so we are stuck with just the filebame
|
||||
#
|
||||
my $otf_template = herefile( q{
|
||||
| <type
|
||||
| format="otf"
|
||||
| name="%s"
|
||||
| glyphs="%s"
|
||||
| />
|
||||
});
|
||||
|
||||
sub do_otf_font {
|
||||
my $file = shift;
|
||||
|
||||
my $name = $file;
|
||||
$name =~ s/^.*\///;
|
||||
$name =~ s/\.otf$//;
|
||||
|
||||
$name =~ s/-?Regular//g;
|
||||
$name =~ s/-?Bold?/B/g;
|
||||
$name =~ s/-?Italic/I/g;
|
||||
$name =~ s/-?Ita?/I/g;
|
||||
$name =~ s/-?Oblique/Ob/g;
|
||||
|
||||
print STDERR join( ' - ', $name ), "\n" if $VERBOSE;
|
||||
printf $otf_template, $name, $file;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------
|
||||
#
|
||||
# Adobe Type fonts
|
||||
#
|
||||
# Get font name from the AFM file
|
||||
my $afm_template_full = herefile( q{
|
||||
| <type
|
||||
| format="type1"
|
||||
| name="%s"
|
||||
| fullname="%s"
|
||||
| family="%s"
|
||||
| glyphs="%s"
|
||||
| metrics="%s"
|
||||
| />
|
||||
});
|
||||
|
||||
sub afm_name {
|
||||
my $file = shift;
|
||||
|
||||
my( $name, $fullname, $family ) = ('','','');
|
||||
if ( open AFM, $file ) {
|
||||
while( <AFM> ) {
|
||||
chop; last if /^StartCharMetrics/;
|
||||
#$name = $1 if /^FontName (.*)/;
|
||||
$fullname = $1 if /^FullName (.*)/;
|
||||
$family = $1 if /^FamilyName (.*)/;
|
||||
}
|
||||
close AFM;
|
||||
|
||||
$family =~ s/\s*L$//; # just the stupid 'L'
|
||||
$fullname =~ s/\bL\b//;
|
||||
|
||||
$name = $fullname;
|
||||
|
||||
$name =~ s/\bRegular\b//; # Junk/abbr decriptive strings
|
||||
$name =~ s/\bDemi\s*[Bb]old\b/Db/g;
|
||||
$name =~ s/\bDemi\s*[Oo]blique\b/Do/g;
|
||||
$name =~ s/\bCondensed\b/C/g;
|
||||
$name =~ s/\bBold\b/B/g;
|
||||
$name =~ s/\bItalic\b/I/g;
|
||||
$name =~ s/\bOblique\b/Ob/g;
|
||||
$name =~ s/\bExtra[Bb]old\b/Xb/g;
|
||||
$name =~ s/\bBlack\b/Bk/g;
|
||||
$name =~ s/\bHeavy\b/H/g;
|
||||
$name =~ s/\bMedium\b/M/g;
|
||||
$name =~ s/\bLight\b/L/g;
|
||||
|
||||
$name =~ s/[-\s]+//g;
|
||||
$fullname =~ s/\s+/ /g;
|
||||
$fullname =~ s/\s$//g;
|
||||
$fullname =~ s/^\s//g;
|
||||
} else {
|
||||
warn "Cannot open $file";
|
||||
}
|
||||
|
||||
return ($name, $fullname, $family ) if $name && $fullname && $family;
|
||||
}
|
||||
|
||||
sub do_afm_fonts {
|
||||
my %atf;
|
||||
# locate abode font files
|
||||
map { my ($k) = m/^(.*?).pfb*$/i; $atf{lc($k)}{pfb} = $_ } locate('pfb');
|
||||
map { my ($k) = m/^(.*?).afm*$/i; $atf{lc($k)}{afm} = $_ } locate('afm');
|
||||
|
||||
# for each Abode font where BOTH files were found.
|
||||
for my $key (keys %atf) {
|
||||
next unless $atf{$key}{pfb} && $atf{$key}{afm};
|
||||
my (@afm) = afm_name($atf{$key}{afm});
|
||||
|
||||
#print STDERR join( ' - ', @afm), "\n" if $VERBOSE;
|
||||
printf $afm_template_full, @afm, $atf{$key}{pfb}, $atf{$key}{afm}
|
||||
if @afm == 3;
|
||||
}
|
||||
}
|
||||
|
||||
# ======================================================================
|
||||
# Option Handling...
|
||||
# ======================================================================
|
||||
|
||||
sub Usage {
|
||||
print STDERR @_, "\n" if @_;
|
||||
@ARGV = ( "$FindBin::Bin/$PROGNAME" );
|
||||
while( <> ) {
|
||||
next if 1 .. 2;
|
||||
last if /^###/;
|
||||
last unless /^#/;
|
||||
s/^#$//; s/^# //;
|
||||
last if /^$/;
|
||||
print STDERR $. == 3 ? "Usage: $_"
|
||||
: " $_";
|
||||
}
|
||||
print STDERR "For full manual use --help\n";
|
||||
exit 10;
|
||||
}
|
||||
sub Help {
|
||||
@ARGV = ( "$FindBin::Bin/$PROGNAME" );
|
||||
while( <> ) {
|
||||
next if $. == 1;
|
||||
last if /^###/;
|
||||
last unless /^#/;
|
||||
s/^#$//; s/^# //;
|
||||
print STDERR;
|
||||
}
|
||||
exit 10;
|
||||
}
|
||||
|
||||
sub do_font {
|
||||
local $_ = shift;
|
||||
|
||||
if ( /\.ttf$/i ) {
|
||||
do_ttf_font($_)
|
||||
}
|
||||
elsif ( $_ =~ /\.otf$/i ) {
|
||||
do_otf_font($_)
|
||||
}
|
||||
else {
|
||||
print STDERR "$PROGNAME: \"$_\" skipped, unknown suffix\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub locate {
|
||||
# Locate font files with the given suffix
|
||||
my $suffix = shift;
|
||||
|
||||
if ( -d "/Library/Fonts" ) { # We must be on MacOSX!
|
||||
# Use a 'find' to discover fonts in that directory only
|
||||
# Find method from Kazuyoshi Tlacaelel - Feb 2017
|
||||
return grep { /\.$suffix$/i && -f $_ }
|
||||
split( "\n", `find /Library/Fonts -type f -name '*.*'` );
|
||||
# map { glob "$_" } # Use glob to expand '?' in locate output
|
||||
# split "\n", `locate -i '.$_[0]'`; # alternative
|
||||
}
|
||||
# All linux system run updatedb and locate - so ask it
|
||||
return split('\0', `locate -0ier '\\.$suffix\$'`);
|
||||
|
||||
#return grep { /\.$_[0]$/i && -f $_ }
|
||||
# map { glob "$_" }
|
||||
# split "\n", `find /Library/Fonts -name '*.*'`;
|
||||
}
|
||||
|
||||
sub herefile { # Handle a multi-line quoted indented string
|
||||
my $string = shift;
|
||||
$string =~ s/^\s*//; # remove start spaces
|
||||
$string =~ s/^\s*\| ?//gm; # remove line starts
|
||||
$string =~ s/\s*$/\n/g; # remove end spaces
|
||||
return $string;
|
||||
}
|
||||
|
||||
OPTION: # Multi-switch option handling
|
||||
while( @ARGV && $ARGV[0] =~ s/^-(?=.)// ) {
|
||||
$_ = shift; {
|
||||
m/^$/ && do { next }; # Next option
|
||||
m/^-$/ && do { last }; # End of options '--'
|
||||
m/^\?/ && do { Help }; # Usage Help '-?'
|
||||
m/^-?(help|doc|man|manual)$/ && Help; # Print help manual comments
|
||||
|
||||
s/^d// && do { $DEBUG++; redo }; # \
|
||||
s/^v// && do { $VERBOSE++; redo }; # /
|
||||
s/^f// && do { $FILE++; redo }; # /
|
||||
|
||||
Usage( "$PROGNAME: Unknown Option \"-$_\"" );
|
||||
} continue { next OPTION }; last OPTION;
|
||||
}
|
||||
|
||||
print herefile( q{
|
||||
| <?xml version="1.0"?>
|
||||
| <typemap>
|
||||
});
|
||||
|
||||
if ( $FILE ) {
|
||||
while( <> ) {
|
||||
s/#.*$//; # ignore comments
|
||||
s/\s+$//; # remove end of line spaces
|
||||
next if /^$/; # skip blank lines
|
||||
|
||||
do_font($_);
|
||||
}
|
||||
}
|
||||
elsif ( @ARGV ) {
|
||||
# TTF font filenames as arguments
|
||||
for ( @ARGV ) {
|
||||
do_font($_);
|
||||
}
|
||||
} else {
|
||||
|
||||
# Generate the "type.xml" file using "locate"
|
||||
print STDERR "Doing TTF fonts\n" if $VERBOSE;
|
||||
for ( locate('ttf') ) {
|
||||
do_ttf_font($_);
|
||||
}
|
||||
print STDERR "Doing OTF fonts\n" if $VERBOSE;
|
||||
for ( locate('otf') ) {
|
||||
do_otf_font($_);
|
||||
}
|
||||
print STDERR "Doing ATM fonts\n" if $VERBOSE;
|
||||
do_afm_fonts();
|
||||
}
|
||||
|
||||
print "</typemap>\n";
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -44,6 +44,14 @@ keywords: # Keywords for SEO
|
||||
---
|
||||
```
|
||||
|
||||
## Preview image mechanism
|
||||
|
||||
Preview image for each page is selected based from the following places in the following order:
|
||||
|
||||
- If document has param `social_preview_image` - it will be used as preview image
|
||||
- If there is a file `static/<path-to-section>/<file-name>-social-preview.png` - it will be used as preview image
|
||||
- Global `preview_image = "/images/social_preview.png"` will be used as preview image
|
||||
|
||||
## Article preview
|
||||
|
||||
Article preview is a set of images that will be used in the article preview. They can be generated from one image. To generate preview images, you need to have [ImageMagick](https://imagemagick.org/index.php) and [cwebp](https://developers.google.com/speed/webp/download) installed.
|
||||
@@ -99,6 +107,26 @@ hideInSidebar: true # Optional. If true, the page will not be shown in the sideb
|
||||
---
|
||||
```
|
||||
|
||||
## Preview images for documentation pages
|
||||
|
||||
Branded individual preview images for documentation pages might be auto-generated using the following command:
|
||||
|
||||
(from the root of the project)
|
||||
|
||||
```bash
|
||||
bash -x automation/generate-all-docs-preview.sh
|
||||
```
|
||||
|
||||
It will automatically insert documentation Section name and Title of the page into the preview.
|
||||
If there is a custom background for the image - it should be placed in the `static/documentation/<section-name>/<page>-bg.png`.
|
||||
<!-- (Use midjourney and one of the styles https://www.notion.so/qdrant/Midjourney-styles-a8dbc94761a74bb287a8a8ad05d593d1 to generate the background) -->
|
||||
|
||||
If there is no custom background - random default background will be used.
|
||||
|
||||
Generated images will be placed in the `static/documentation/<section-name>/<page>-social-preview.png`.
|
||||
|
||||
To re-generate preview image, remove the previously generated one and run the command again.
|
||||
|
||||
## Documentation sidebar
|
||||
|
||||
### Delimiter
|
||||
|
||||
|
After Width: | Height: | Size: 602 KiB |
|
After Width: | Height: | Size: 592 KiB |
|
After Width: | Height: | Size: 600 KiB |
|
After Width: | Height: | Size: 608 KiB |
|
After Width: | Height: | Size: 618 KiB |
|
After Width: | Height: | Size: 604 KiB |
|
After Width: | Height: | Size: 619 KiB |
|
After Width: | Height: | Size: 607 KiB |
|
After Width: | Height: | Size: 627 KiB |
|
After Width: | Height: | Size: 612 KiB |
|
After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 604 KiB |
|
After Width: | Height: | Size: 638 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1014 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 963 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 963 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 998 KiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 994 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 872 KiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 929 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 975 KiB |
|
After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 591 KiB |
|
After Width: | Height: | Size: 658 KiB |
|
After Width: | Height: | Size: 596 KiB |
|
After Width: | Height: | Size: 595 KiB |
|
After Width: | Height: | Size: 597 KiB |
|
After Width: | Height: | Size: 603 KiB |
|
After Width: | Height: | Size: 646 KiB |
|
After Width: | Height: | Size: 608 KiB |
|
After Width: | Height: | Size: 594 KiB |
|
After Width: | Height: | Size: 620 KiB |
|
After Width: | Height: | Size: 592 KiB |
|
After Width: | Height: | Size: 608 KiB |
|
After Width: | Height: | Size: 605 KiB |
|
After Width: | Height: | Size: 598 KiB |
|
After Width: | Height: | Size: 648 KiB |
|
After Width: | Height: | Size: 662 KiB |
|
After Width: | Height: | Size: 640 KiB |
|
After Width: | Height: | Size: 593 KiB |
|
After Width: | Height: | Size: 608 KiB |