Fix system fonts search
This commit is contained in:
parent
eaafa5e291
commit
d1d5ba72ce
|
@ -2,7 +2,7 @@
|
|||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
|
@ -22,7 +22,7 @@
|
|||
" N_horizontal = img_shape[0]//(tamano_letra)\n",
|
||||
"\n",
|
||||
" # Get system font types\n",
|
||||
" system_fonts = font_manager.get_fontconfig_fonts()\n",
|
||||
" system_fonts = font_manager.findSystemFonts()\n",
|
||||
" # Filter out some non-readable fonts\n",
|
||||
" ttf_fonts = [font for font in system_fonts if ((\".ttf\" in font) and (\"lohit\" not in font) and (\"kacst\" not in font)) and (\"Navilu\" not in font) and (\"telu\" not in font) and (\"lyx\" not in font) and (\"malayalam\" not in font) and (\"tlwg\" not in font) and (\"samyak\" not in font) and (\"droid\" not in font) and (\"kalapi\" not in font) and (\"openoffice\" not in font) and (\"orya\" not in font)]\n",
|
||||
"\n",
|
||||
|
@ -51,7 +51,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 210,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
@ -60,26 +60,17 @@
|
|||
"text": [
|
||||
"147\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/tmp/ipykernel_28967/2165524556.py:1: MatplotlibDeprecationWarning: \n",
|
||||
"The get_fontconfig_fonts function was deprecated in Matplotlib 3.5 and will be removed two minor releases later.\n",
|
||||
" system_fonts = font_manager.get_fontconfig_fonts()#findSystemFonts(fontpaths=None, fontext='ttf')\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"system_fonts = font_manager.get_fontconfig_fonts()#findSystemFonts(fontpaths=None, fontext='ttf')\n",
|
||||
"system_fonts = font_manager.findSystemFonts(fontpaths=None, fontext='ttf')\n",
|
||||
"ttf_fonts = [font for font in system_fonts if ((\".ttf\" in font) and (\"lohit\" not in font) and (\"kacst\" not in font)) and (\"Navilu\" not in font) and (\"telu\" not in font) and (\"lyx\" not in font) and (\"malayalam\" not in font) and (\"tlwg\" not in font) and (\"samyak\" not in font) and (\"droid\" not in font) and (\"kalapi\" not in font) and (\"openoffice\" not in font) and (\"orya\" not in font)]\n",
|
||||
"print(len(ttf_fonts))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 209,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
|
@ -87,50 +78,14 @@
|
|||
"output_type": "stream",
|
||||
"text": [
|
||||
"33\n",
|
||||
"7\n",
|
||||
"Font N 0: /usr/share/fonts/truetype/liberation2/LiberationSans-BoldItalic.ttf\n",
|
||||
"Font N 1: /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf\n",
|
||||
"Font N 2: /usr/share/fonts/truetype/ubuntu/Ubuntu-C.ttf\n",
|
||||
"Font N 3: /usr/share/fonts/truetype/ttf-bitstream-vera/VeraBI.ttf\n",
|
||||
"Font N 4: /usr/share/fonts/truetype/ubuntu/UbuntuMono-R.ttf\n",
|
||||
"Font N 5: /usr/share/fonts/truetype/lato/Lato-LightItalic.ttf\n",
|
||||
"Font N 6: /usr/share/fonts/truetype/liberation2/LiberationSans-BoldItalic.ttf\n",
|
||||
"Font N 7: /usr/share/fonts/truetype/liberation2/LiberationSans-Bold.ttf\n",
|
||||
"Font N 8: /usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf\n",
|
||||
"Font N 9: /usr/share/fonts/truetype/fonts-gujr-extra/Rekha.ttf\n",
|
||||
"Font N 10: /usr/share/fonts/truetype/fonts-beng-extra/MuktiNarrowBold.ttf\n",
|
||||
"Font N 11: /usr/share/fonts/truetype/tibetan-machine/TibetanMachineUni.ttf\n",
|
||||
"Font N 12: /usr/share/fonts/truetype/Sahadeva/sahadeva.ttf\n",
|
||||
"Font N 13: /usr/share/fonts/truetype/lato/Lato-Heavy.ttf\n",
|
||||
"Font N 14: /usr/share/fonts/truetype/padauk/PadaukBook-Bold.ttf\n",
|
||||
"Font N 15: /usr/share/fonts/truetype/padauk/Padauk-Bold.ttf\n",
|
||||
"Font N 16: /usr/share/fonts/truetype/lato/Lato-Regular.ttf\n",
|
||||
"Font N 17: /usr/share/fonts/truetype/pagul/Pagul.ttf\n",
|
||||
"Font N 18: /usr/share/fonts/truetype/fonts-yrsa-rasa/Yrsa-SemiBold.ttf\n",
|
||||
"Font N 19: /usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf\n",
|
||||
"Font N 20: /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf\n",
|
||||
"Font N 21: /usr/share/fonts/truetype/fonts-beng-extra/JamrulNormal.ttf\n",
|
||||
"Font N 22: /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf\n",
|
||||
"Font N 23: /usr/share/fonts/truetype/lato/Lato-Italic.ttf\n",
|
||||
"Font N 24: /usr/share/fonts/truetype/liberation2/LiberationSerif-Regular.ttf\n",
|
||||
"Font N 25: /usr/share/fonts/truetype/ubuntu/Ubuntu-L.ttf\n",
|
||||
"Font N 26: /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf\n",
|
||||
"Font N 27: /usr/share/fonts/truetype/dejavu/DejaVuSerifCondensed-Bold.ttf\n",
|
||||
"Font N 28: /usr/share/fonts/truetype/dejavu/DejaVuSerifCondensed-Bold.ttf\n",
|
||||
"Font N 29: /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf\n",
|
||||
"Font N 30: /usr/share/fonts/truetype/fonts-yrsa-rasa/Yrsa-Medium.ttf\n",
|
||||
"Font N 31: /usr/share/fonts/truetype/freefont/FreeSans.ttf\n",
|
||||
"Font N 32: /usr/share/fonts/truetype/fonts-gujr-extra/padmaa-Bold.1.1.ttf\n"
|
||||
"7\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/tmp/ipykernel_28967/2273520072.py:44: MatplotlibDeprecationWarning: \n",
|
||||
"The get_fontconfig_fonts function was deprecated in Matplotlib 3.5 and will be removed two minor releases later.\n",
|
||||
" system_fonts = font_manager.get_fontconfig_fonts()\n",
|
||||
"/tmp/ipykernel_28967/2273520072.py:59: DeprecationWarning: getsize is deprecated and will be removed in Pillow 10 (2023-07-01). Use getbbox or getlength instead.\n",
|
||||
"/tmp/ipykernel_34832/450411713.py:33: DeprecationWarning: getsize is deprecated and will be removed in Pillow 10 (2023-07-01). Use getbbox or getlength instead.\n",
|
||||
" posicion_texto = ((imagen.width - fuente.getsize(texto_linea)[0]) // 2,\n"
|
||||
]
|
||||
}
|
||||
|
@ -186,7 +141,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.13"
|
||||
"version": "3.11.5"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue