本文介绍了在Roku中更改默认字体roFontRegistry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用roImageCanvas创建了一个页面,并且正在尝试改变它的默认字体。另外一个是.Bellow是我的代码,但是这个不行。请帮我解决这个错误。提前感谢。
I have created a page with roImageCanvas ,and i am trying to change its default font with another one.bellow is my code but this won't work.Please help me to resolve this error.thanks in advance.
canvas = CreateObject("roImageCanvas")
port = CreateObject("roMessagePort")
canvas.SetMessagePort(port)
items = []
FontInterface=CreateObject("roFontRegistry") 'create global font access
Fontinterface.Register("pkg:/source/Univers.ttf")
Font=FontInterface.GetFont("Univers",36,false,false)
FontSmall=FontInterface.GetFont("Univers",15,false,false)
items.Push({
Text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"
TextAttrs:{ font: Font, color: "#a0a0a0"}
TargetRect: {x: 200, y: 75, w: 300, h: 500}
})
items.Push({
Text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"
TextAttrs:{ font: FontSmall, color: "#a0a0a0"}
TargetRect: {x: 600, y: 75, w: 300, h: 500}
})
canvas.SetLayer(0, { Color: "#00ff00", CompositionMode: "Source" })
canvas.SetLayer(1, items)
canvas.Show()
推荐答案
使用
Font=FontInterface.Get("Univers",36,false,false)
FontSmall=FontInterface.Get("Univers",15,false,false)
Font=FontInterface.GetFont("Univers",36,false,false)
FontSmall=FontInterface.GetFont("Univers",15,false,false)
这篇关于在Roku中更改默认字体roFontRegistry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!