diff --git a/.gitignore b/.gitignore index ede8050d02..6549d6b6a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/assets/fonts tests/clover.xml .idea node_modules/ diff --git a/.nextcloudignore b/.nextcloudignore index d3a72d88c0..491a43ceaa 100644 --- a/.nextcloudignore +++ b/.nextcloudignore @@ -1,4 +1,5 @@ src +build .git tests node_modules diff --git a/assets/fonts/.gitkeep b/assets/fonts/.gitkeep new file mode 100644 index 0000000000..f0234b9523 --- /dev/null +++ b/assets/fonts/.gitkeep @@ -0,0 +1 @@ +Fonts will be added here during release build thorugh the build/download-fonts.sh script. \ No newline at end of file diff --git a/build/download-fonts.sh b/build/download-fonts.sh new file mode 100755 index 0000000000..3a8bf8667a --- /dev/null +++ b/build/download-fonts.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Download font files and put them into the assets/fonts folder for the release + +FONTLIST=( + "https://github.com/google/fonts/raw/main/ofl/amaticsc/AmaticSC-Regular.ttf" + "https://github.com/google/fonts/raw/main/ofl/amaticsc/AmaticSC-Bold.ttf" + "https://github.com/google/fonts/blob/main/ofl/caveat/Caveat%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/comfortaa/Comfortaa%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/ebgaramond/EBGaramond%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/lexend/Lexend%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/lobster/Lobster-Regular.ttf" + "https://github.com/google/fonts/raw/main/ofl/lora/Lora%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/montserrat/Montserrat%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/nunito/Nunito%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/oswald/Oswald%5Bwght%5D.ttf" + "https://github.com/google/fonts/raw/main/ofl/pacifico/Pacifico-Regular.ttf" + "https://github.com/google/fonts/raw/main/ofl/playfairdisplay/PlayfairDisplay%5Bwght%5D.ttf" + "https://github.com/google/fonts/blob/main/ofl/roboto/Roboto%5Bwdth%2Cwght%5D.ttf" + "https://github.com/google/fonts/raw/main/apache/robotomono/RobotoMono%5Bwght%5D.ttf" + "https://github.com/google/fonts/blob/main/ofl/spectral/Spectral-Regular.ttf" +) + +rm assets/fonts/* + +function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } + +for font in "${FONTLIST[@]}"; do + echo "$font" + wget -q -P assets/fonts/ $font + + FILENAME=$(urldecode "$(basename "$font")") + + if [[ $FILENAME == *"wght"* ]]; then + NEWFILENAME=$(echo $FILENAME | sed 's/\[wght\]/-wght/g') + NEWFILENAME=$(echo $NEWFILENAME | sed 's/\[wdth,wght\]/-wdtg-wght/g') + mv assets/fonts/$FILENAME assets/fonts/$NEWFILENAME + else + NEWFILENAME=$(echo $FILENAME) + fi + + echo "$FILENAME" + FONTNAME=$(echo $NEWFILENAME | sed 's/.ttf//g') + + echo "$(dirname $font)/OFL.txt" + wget -q -O "assets/fonts/$FONTNAME.LICENSE.txt" "$(dirname $font)/OFL.txt" +done \ No newline at end of file diff --git a/krankerl.toml b/krankerl.toml index a7398b7508..39210c65c8 100644 --- a/krankerl.toml +++ b/krankerl.toml @@ -2,6 +2,7 @@ before_cmds = [ "composer install --working-dir=composer/", "composer dump --working-dir=composer/", + "bash ./build/download-fonts.sh", "npm ci", "npm run build" ] diff --git a/lib/Migration/InstallDefaultFonts.php b/lib/Migration/InstallDefaultFonts.php index 573051d8d8..8b58d1f791 100644 --- a/lib/Migration/InstallDefaultFonts.php +++ b/lib/Migration/InstallDefaultFonts.php @@ -18,7 +18,7 @@ public function getName(): string { public function run(IOutput $output): void { $appVersion = $this->config->getAppValue('richdocuments', 'installed_version'); - if (!empty($appVersion) && version_compare($appVersion, '8.2.2') < 1) { + if (!empty($appVersion) && version_compare($appVersion, '8.3.0', '>')) { return; } diff --git a/lib/Service/FontService.php b/lib/Service/FontService.php index e41d97721b..99b8ea7d3a 100644 --- a/lib/Service/FontService.php +++ b/lib/Service/FontService.php @@ -261,7 +261,7 @@ public function installDefaultFonts(): void { } while (false !== ($fileName = readdir($handle))) { - if ($fileName === '.' || $fileName === '..') { + if (\str_starts_with($fileName, '.') || \str_ends_with($fileName, '.txt')) { continue; } diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue index 73b01be088..b63423d7e1 100644 --- a/src/components/AdminSettings.vue +++ b/src/components/AdminSettings.vue @@ -527,7 +527,7 @@ export default { fontXmlHint() { return ` - ${this.fontHintUrl} + ${this.fontHintUrl} ` },