繁体   English   中英

Windows Phone IE中的连字符

[英]Hyphens in windows phone IE

在Windows Phone 8的IE中需要有连字符(或在7/8上都更好)。 我正在使用Web浏览器控件来显示内容,并且正在嵌入一些CSS以使字体更漂亮。 看来IE的移动版本真的很流行! 例如p:first-child:first-letter不起作用hyphens:auto也不起作用。 有没有变通方法来在页边距文本中添加连字符?

PS现在尝试使用Hyphenator.js ,但是存在问题,因为找不到在Webbrowser控件中将本地脚本包含到页面中的方法(即使用NavigateToString)。

您可以引用本地javascript文件,但需要先将其加载到独立存储中。

这样可以将它们加载到本地存储中。

var fileResourceStreamInfo = Application.GetResourceStream(new Uri("scripts/Hyphenator.js", UriKind.Relative));
if (fileResourceStreamInfo != null)
{
using (BinaryReader br = new BinaryReader(fileResourceStreamInfo.Stream))
{
    byte[] data = br.ReadBytes((int)fileResourceStreamInfo.Stream.Length);

    string strBaseDir = "scripts";

    if(!appStorage.DirectoryExists(strBaseDir))
    {
        //Debug.WriteLine("Creating Directory :: " + strBaseDir);
        appStorage.CreateDirectory(strBaseDir);
    }

    // This will truncate/overwrite an existing file, or 
    using (IsolatedStorageFileStream outFile = appStorage.OpenFile(AppRoot + "scripts/Hyphenator.js", FileMode.Create))
    {
        Debug.WriteLine("Writing data for " + AppRoot + "scripts/Hyphenator.js" + " and length = " + data.Length);
        using (var writer = new BinaryWriter(outFile))
        {
            writer.Write(data);
        }
    }
}

}

然后,您可以像这样引用它们:

<script type="text/javascript" src="scripts/Hyphenator.js"></script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM