-- =============================================================================
-- 一个字体框架和更为简洁的本地字体
-- 你可以添加属于自己的本地字体,以下的就是例子(最后一行)
-- =============================================================================
ClearFont = CreateFrame("Frame", "ClearFont");
-- 如果你想使用自由高度和宽度的话,可将'Fonts' 改成'Fonts 2'
local CLEAR_FONT_BASE = "Fonts\\";
local CLEAR_FONT = CLEAR_FONT_BASE .. "FZLBJW.TTF";
local CLEAR_FONT_NUMBER = CLEAR_FONT_BASE .. "ARIALN.TTF";
local CLEAR_FONT_ZONE = CLEAR_FONT_BASE .. "FZL2JW.TTF";
local CLEAR_FONT_DAMAGE = CLEAR_FONT_BASE .. "FZJZJW.TTF";
local CLEAR_FONT_QUESTTITLE = CLEAR_FONT_BASE .. "LBJW.TTF";
local CLEAR_FONT_QUEST = CLEAR_FONT_BASE .. "FZBWJW.TTF";
注意这些,记好这些有助你在设置自己界面不同位置的字体,下面有这些clear-fonts******的具体使用地方,可以上下做比较来看
-- 添加属于自己的字体
local YOUR_FONT_STYLE = CLEAR_FONT_BASE .. "YourFontName.ttf";
-- 字体的比例:比如,你想把所有字体缩小到80%,那么可以将"1"改成"0.8"
local CF_SCALE = 1
-- 查看现有的字体并变化它们
-----------------------------------------------------
local function CanSetFont(object)
return (type(object)=="table"
and object.SetFont and object.IsObjectType
and not object:IsObjectType("SimpleHTML"));
end
-- =============================================================================
-- 标准WOW用户界面这一部分
-- =============================================================================
-- 这是最需要编辑的一块内容
-- 主要的字体已经列出,其余部分字体按照字母表顺序排列
-- 如果在补丁改变的情况下,陈述(声明)可能会有所忽略
-- =============================================================================
-- 举个例子:游戏初始字体如下:SetFont(CLEAR_FONT, 13 * CF_SCALE)
-- 在括号里的第一部分是字体类型,第二部分是字体大小
-- 根据个人所需而改变
-- =============================================================================
function ClearFont:ApplySystemFonts()
-- 世界环境中、3D字体等 (Dark Imakuni)
--------------------------------------------
-- 聊天泡泡
STANDARD_TEXT_FONT = CLEAR_FONT;
看好了,这些就是对应的你设定的fonts的设定连接,比如说,
你在WOW的根目录下的fonts目录中找了一个你喜欢的字体,你想这个字体成为你聊天字体,那么联系前面的高亮的那些,
你要把这个字体文件的名字改成FZLBJW.TTF就OK!当然,很多的时候,这一个文件不见得使用在同一个地方,设置的不合理
也会给视觉造成影响,具体挑选什么样的字体来设定,就要看你自己审美了,不过说起来,你也可以把这个clear-fonts改成其他的不是
如果你觉得出现这样的情况,比如说,你的聊天字体和下面的那个人头字体是同样的,但是你不喜欢,OK,你随便改哪儿个都可以,
字体如何使用都是你自己设定的,这里的一些循环判断的object都是可以改的,你做的够细致完全可以做到!
-- 人头上的名字
UNIT_NAME_FONT = CLEAR_FONT;
NAMEPLATE_FONT = CLEAR_FONT;
-- 显示在被攻击目标头上的效果 (和插件SCT/SDT无关)
DAMAGE_TEXT_FONT = CLEAR_FONT_DAMAGE;
-- 拾取菜单字体大小
UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = 12 * CF_SCALE;
-- 系统字体
--------------
if (CanSetFont(SystemFont)) then SystemFont:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
-- 主要字体: 显示在各处的可见主要字体部分
-------------------------------------------------------
if (CanSetFont(GameFontNormal)) then GameFontNormal:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
如果 允许设置更改字体 (此时字体默认游戏本身设定) 然后 将默认字体 修改成 clear-fonts(对应的就是FZLBJW.TTF)14号字 结束
if (CanSetFont(GameFontHighlight)) then GameFontHighlight:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
游戏默认高亮字体
if (CanSetFont(GameFontDisable)) then SystemFont:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontDisable)) then GameFontDisable:SetTextColor(0.6, 0.6, 0.6); end
字体比例,0.1~1随便你调整,自己看怎么合适怎么改
if (CanSetFont(GameFontGreen)) then GameFontGreen:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontRed)) then GameFontRed:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontWhite)) then GameFontWhite:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontBlack)) then GameFontBlack:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
这些循环判断,就是在你的主要界面中体现的,具体的下面各个颜色和使用,建议你在使用狂鼠插件的时候自己去摸索下,有时候想要一个自己满意的东西,就要自己去摸索,如何使用的更好,just try once and again.
然后,下面的这些设定也几乎就是千篇一律了,无非是各个地方,各种情况下使用的字体,大小设置,修改后关联的你设定的字体文件名而已。如果你不满意所有的,自己去尝试改,DIY下。
需要注意的是,往往,你只需要修改then语段后面()里的部分,就是关联的字体,大小而已
-- 小字体: 也用在泰坦数据面板(插件)
---------------------------------------------
if (CanSetFont(GameFontNormalSmall)) then GameFontNormalSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontDisableSmall)) then GameFontDisableSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontDisableSmall)) then GameFontDisableSmall:SetTextColor(0.6, 0.6, 0.6); end
if (CanSetFont(GameFontDarkGraySmall)) then GameFontDarkGraySmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontDarkGraySmall)) then GameFontDarkGraySmall:SetTextColor(0.4, 0.4, 0.4); end
if (CanSetFont(GameFontGreenSmall)) then GameFontGreenSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontRedSmall)) then GameFontRedSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontHighlightSmall)) then GameFontHighlightSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameFontHighlightSmallOutline)) then GameFontHighlightSmallOutline:SetFont(CLEAR_FONT, 12 * CF_SCALE, "OUTLINE"); end
-- 大字体: 标题
---------------------------
if (CanSetFont(GameFontNormalLarge)) then GameFontNormalLarge:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontHighlightLarge)) then GameFontHighlightLarge:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontDisableLarge)) then GameFontDisableLarge:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontDisableLarge)) then GameFontDisableLarge:SetTextColor(0.6, 0.6, 0.6); end
if (CanSetFont(GameFontGreenLarge)) then GameFontGreenLarge:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(GameFontRedLarge)) then GameFontRedLarge:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
-- 极大字体: Raid警报
---------------------------------
if (CanSetFont(GameFontNormalHuge)) then GameFontNormalHuge:SetFont(CLEAR_FONT, 21 * CF_SCALE); end
-- 战斗字: in-built SCT-style 信息 (仅1.12版有)
------------------------------------------------------
if (CanSetFont(CombatTextFont)) then CombatTextFont:SetFont(CLEAR_FONT, 26 * CF_SCALE); end
-- 数字字体: 拍卖行、金钱、键盘、数量叠加的用户界面
------------------------------------------------------------------------------
if (CanSetFont(NumberFontNormal)) then NumberFontNormal:SetFont(CLEAR_FONT_NUMBER, 13 * CF_SCALE, "OUTLINE"); end
if (CanSetFont(NumberFontNormalYellow)) then NumberFontNormalYellow:SetFont(CLEAR_FONT_NUMBER, 13 * CF_SCALE, "OUTLINE"); end
if (CanSetFont(NumberFontNormalSmall)) then NumberFontNormalSmall:SetFont(CLEAR_FONT_NUMBER, 11 * CF_SCALE, "OUTLINE"); end
if (CanSetFont(NumberFontNormalSmallGray)) then NumberFontNormalSmallGray:SetFont(CLEAR_FONT_NUMBER, 11 * CF_SCALE, "OUTLINE"); end
if (CanSetFont(NumberFontNormalLarge)) then NumberFontNormalLarge:SetFont(CLEAR_FONT_NUMBER, 15 * CF_SCALE, "OUTLINE"); end
if (CanSetFont(NumberFontNormalHuge)) then NumberFontNormalHuge:SetFont(CLEAR_FONT_DAMAGE, 24 * CF_SCALE, "THICKOUTLINE"); end
if (CanSetFont(NumberFontNormalHuge)) then NumberFontNormalHuge:SetAlpha(30); end
-- 聊天窗口输入字体和聊天窗口字体大小
下面这部分是为了对应你在游戏中调整聊天字体大小的一个映射
--------------------------------------------------
if (CanSetFont(ChatFontNormal)) then ChatFontNormal:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
CHAT_FONT_HEIGHTS = {
[1] = 7,
[2] = 8,
[3] = 9,
[4] = 10,
[5] = 11,
[6] = 12,
[7] = 13,
[8] = 14,
[9] = 15,
[10] = 16,
[11] = 17,
[12] = 18,
[13] = 19,
[14] = 20,
[15] = 21,
[16] = 22,
[17] = 23,
[18] = 24
};
-- 任务日志: 任务、书籍等
----------------------------------------------------
if (CanSetFont(QuestTitleFont)) then QuestTitleFont:SetFont(CLEAR_FONT_QUESTTITLE, 18 * CF_SCALE); end
if (CanSetFont(QuestTitleFont)) then QuestTitleFont:SetShadowColor(0.54, 0.4, 0.1); end
if (CanSetFont(QuestFont)) then QuestFont:SetFont(CLEAR_FONT_QUEST, 14 * CF_SCALE); end
if (CanSetFont(QuestFont)) then QuestFont:SetTextColor(0.15, 0.09, 0.04); end
if (CanSetFont(QuestFontNormalSmall)) then QuestFontNormalSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(QuestFontNormalSmall)) then QuestFontNormalSmall:SetShadowColor(0.54, 0.4, 0.1); end
if (CanSetFont(QuestFontHighlight)) then QuestFontHighlight:SetFont(CLEAR_FONT_QUEST, 13 * CF_SCALE); end
-- 对话框: “同意”等字样
---------------------------------
if (CanSetFont(DialogButtonNormalText)) then DialogButtonNormalText:SetFont(CLEAR_FONT, 13 * CF_SCALE); end
if (CanSetFont(DialogButtonHighlightText)) then DialogButtonHighlightText:SetFont(CLEAR_FONT, 13 * CF_SCALE); end
-- 错误字体: “另一个动作正在进行中”等字样
-------------------------------------------------------------
if (CanSetFont(ErrorFont)) then ErrorFont:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
if (CanSetFont(ErrorFont)) then ErrorFont:SetAlpha(60); end
-- 物品信息: 框架内的综合使用形式(大概包括任务物品的版面字体,比如可以携带的书籍)
-------------------------------------
if (CanSetFont(ItemTextFontNormal)) then ItemTextFontNormal:SetFont(CLEAR_FONT_QUEST, 15 * CF_SCALE); end
-- 邮件和发货单字体: 游戏中邮件和拍卖行发货单
--------------------------------------------------------------
if (CanSetFont(MailTextFontNormal)) then MailTextFontNormal:SetFont(CLEAR_FONT_QUEST, 15 * CF_SCALE); end
if (CanSetFont(MailTextFontNormal)) then MailTextFontNormal:SetTextColor(0.15, 0.09, 0.04); end
if (CanSetFont(MailTextFontNormal)) then MailTextFontNormal:SetShadowColor(0.54, 0.4, 0.1); end
if (CanSetFont(MailTextFontNormal)) then MailTextFontNormal:SetShadowOffset(1, -1); end
if (CanSetFont(InvoiceTextFontNormal)) then InvoiceTextFontNormal:SetFont(CLEAR_FONT_QUEST, 13 * CF_SCALE); end
if (CanSetFont(InvoiceTextFontNormal)) then InvoiceTextFontNormal:SetTextColor(0.15, 0.09, 0.04); end
if (CanSetFont(InvoiceTextFontSmall)) then InvoiceTextFontSmall:SetFont(CLEAR_FONT_QUEST, 11 * CF_SCALE); end
if (CanSetFont(InvoiceTextFontSmall)) then InvoiceTextFontSmall:SetTextColor(0.15, 0.09, 0.04); end
-- 技能书: 技能副题
--------------------------------
if (CanSetFont(SubSpellFont)) then SubSpellFont:SetFont(CLEAR_FONT_QUEST, 12 * CF_SCALE); end
-- 状态栏: 单位框架的数字和伤害计算器(插件)
---------------------------------------------------------
if (CanSetFont(TextStatusBarText)) then TextStatusBarText:SetFont(CLEAR_FONT_NUMBER, 13 * CF_SCALE, "OUTLINE"); end
if (CanSetFont(TextStatusBarTextSmall)) then TextStatusBarTextSmall:SetFont(CLEAR_FONT, 14); end
-- 提示面板
-----------
if (CanSetFont(GameTooltipText)) then GameTooltipText:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameTooltipTextSmall)) then GameTooltipTextSmall:SetFont(CLEAR_FONT, 12 * CF_SCALE); end
if (CanSetFont(GameTooltipHeaderText)) then GameTooltipHeaderText:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
-- 世界地图: 位置名称
-----------------------------
if (CanSetFont(WorldMapTextFont)) then WorldMapTextFont:SetFont(CLEAR_FONT_ZONE, 102 * CF_SCALE, "THICKOUTLINE"); end
if (CanSetFont(WorldMapTextFont)) then WorldMapTextFont:SetShadowColor(0, 0, 0); end
if (CanSetFont(WorldMapTextFont)) then WorldMapTextFont:SetShadowOffset(1, -1); end
if (CanSetFont(WorldMapTextFont)) then WorldMapTextFont:SetAlpha(40); end
-- 区域切换显示: 在屏幕中央通知
----------------------------------------
if (CanSetFont(ZoneTextFont)) then ZoneTextFont:SetFont(CLEAR_FONT_ZONE, 112 * CF_SCALE, "THICKOUTLINE"); end
if (CanSetFont(ZoneTextFont)) then ZoneTextFont:SetShadowColor(0, 0, 0); end
if (CanSetFont(ZoneTextFont)) then ZoneTextFont:SetShadowOffset(1, -1); end
if (CanSetFont(SubZoneTextFont)) then SubZoneTextFont:SetFont(CLEAR_FONT_ZONE, 26 * CF_SCALE, "THICKOUTLINE"); end
-- 看上去不再被使用
---------------------------------------------------
if (CanSetFont(CombatLogFont)) then CombatLogFont:SetFont(CLEAR_FONT, 14 * CF_SCALE); end
end
-- =============================================================================
-- C. FUNCTION TO RELOAD EVERY TIME AN ADDON LOADS
-- They do like to mess up my addon!
-- =============================================================================
ClearFont:SetScript("OnEvent",
function()
if (event == "ADDON_LOADED") then
ClearFont:ApplySystemFonts()
end
end);
ClearFont:RegisterEvent("ADDON_LOADED");
-- =============================================================================
-- D. APPLY ALL THE ABOVE ON FIRST RUN
-- To start the ball rolling
-- =============================================================================
ClearFont:ApplySystemFonts()
然后我们来看下这个LUA编辑后的变化.然后看的出变化了吧!自定义的时候自己可以随便加,或者修改不同的字体类型,插件很笨的,改个名字它就不知道你是李逵还是李达了。自己动手吧!
[
本帖最后由 邪恶的kristina 于 2007-3-16 13:34 编辑 ]