Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th March 2017, 01:29   #1  |  Link
Leo D9
Registered User
 
Join Date: Feb 2013
Posts: 9
Can AviSynth use/load/import a font file that isn't in Windows' Fonts folder?

Can AviSynth use/load/import a font file that isn't in Windows' Fonts folder?

I have the TTF file, which I would like to use for subtitles, but I would prefer other users of my script not to have to copy it into their Windows' Fonts folder. I don't want them to modify their system in any way other than installing AviSynth itself. Is there any way to load the font file in my script or by some other means?

Thanks.
Leo D9 is offline   Reply With Quote
Old 15th March 2017, 01:38   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,676
https://forum.doom9.org/showthread.php?t=148926
sneaker_ger is offline   Reply With Quote
Old 17th March 2017, 13:31   #3  |  Link
Leo D9
Registered User
 
Join Date: Feb 2013
Posts: 9
Interesting to know about, and I guess it proves it could be done with an external plugin, but would I have to then write the text to a .ass file to be able to use this, rather than just passing it as a parameter? Also, I don't see how I can load a font file with this plugin, unless the ASS file itself can load the file or link to it. I've never used ASS.

I need to render title text that is generated within the script, with a specific font, rather than displaying normal subtitles from a file. It seems that assrender would be quite a laborious way to achieve this, or may not be able to load a font file at all. Also, it speaks about font caching - would that cache all the fonts on the user's system?

Basically I just want something that is equivalent to:

Subtitle("My text here", font_file="Font Name.ttf")

I may have to force the user to install the font on their system :/

Thanks.
Leo D9 is offline   Reply With Quote
Old 17th March 2017, 13:46   #4  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,546
Quote:
Originally Posted by Leo D9 View Post
I may have to force the user to install the font on their system
Correct.

For reference, documentation of "subtitle" parameters here.

There is a plugin called "SubtitleEx" but that just adds visual effects.
Groucho2004 is offline   Reply With Quote
Old 17th March 2017, 13:54   #5  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,676
@Leo D9:
Read the assrender readme. srt with font from file instead of system is possible. Text directly in AviSynth script instead of subtitle file is not AFAIK. Maybe you can abuse some file writer plugin if you need that badly ...
sneaker_ger is offline   Reply With Quote
Old 17th March 2017, 14:03   #6  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 171
You can attach fonts with Aegi sub to .ass files. Tested with VSfiltermod.
__________________
Search and denoise
ChaosKing is offline   Reply With Quote
Old 17th March 2017, 14:16   #7  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,546
Quote:
Originally Posted by sneaker_ger View Post
Maybe you can abuse some file writer plugin if you need that badly ...
Awkward but that would probably work.
Groucho2004 is offline   Reply With Quote
Old 17th March 2017, 17:43   #8  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 782
Interesting idea, and it was not was not much work to integrate it in Avisynth+, so it will appear in the next release. It will look like
Code:
Subtitle("Roboto Test", x=-1, y=50, font_width=0, font="Dancing Script1002", font_filename="DancingScript-Regular.ttf")
Subtitle("Roboto Test", x=-1, y=75, font_width=0, font="Dancing Script1002")
There was no need to load the font for the second SubTitle.
pinterf is offline   Reply With Quote
Old 22nd March 2017, 03:23   #9  |  Link
Leo D9
Registered User
 
Join Date: Feb 2013
Posts: 9
Great that it is being included Thanks.

Any chance of text that can be centred vertically as well as horizontally? (e.g. if over several lines using \n )
Leo D9 is offline   Reply With Quote
Old 22nd March 2017, 15:33   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,161
Perhaps this can be hacked, just add font_filename arg to func, and pass it on to the Subtitle call.

Code:
#Avisource("D:\avs\test.avi")
Colorbars.killaudio
Function Sub(clip c, string text, float "x", float "y", int "first_frame", int "last_frame", string "font", float "size", \
    int "text_color", int "halo_color", int "align", int "spc", int "lsp", float "font_width", float "font_angle", bool "interlaced", \
    bool "vcenter") {
	c
	GScript("""
		size=Default(size,18)
		vcenter=Default(vcenter,false)
		if(vcenter && Defined(align) && Defined(lsp) && (align>=4 && align<=6)) {
		        s=RT_StrReplace(text,"\n",Chr(10),Sig=false)    # Replace String case Insignificant
        		Lines = RT_TxtQueryLines(s)                     # Line count with/without final newline
				y=(Height/2) - ((Lines-1) * size / 2.0)
		}
	""")	
	Subtitle(text,x,y,first_frame,last_frame,font,size,text_color,halo_color,align,spc,lsp,font_width,font_angle,interlaced)
}

VC=True
#VC=False

S="The\nQuick\nBrown\nfox\njumped\nover\nthe\nlazy\ndog.\nThe\nQuick\nBrown\nfox\njumped\nover\nthe\nlazy\ndog.\n"

Sub(S,lsp=0,align=4,vcenter=VC)
Sub(S,lsp=0,align=5,vcenter=VC)
Sub(S,lsp=0,align=6,vcenter=VC)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but are any of them infinitely bigger ???
StainlessS is offline   Reply With Quote
Reply

Tags
avisynth, font, import, load, ttf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 17:22.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.