简体   繁体   English

Windows Phone IE中的连字符

[英]Hyphens in windows phone IE

Need to have hyphens in IE on windows phone 8(or better on both 7/8). 在Windows Phone 8的IE中需要有连字符(或在7/8上都更好)。 I'm using web browser control to show content and i'm embedding some css to make typography prettier. 我正在使用Web浏览器控件来显示内容,并且正在嵌入一些CSS以使字体更漂亮。 It seems that mobile version of IE is really cropped! 看来IE的移动版本真的很流行! For example p:first-child:first-letter is not working.. hyphens:auto is not working too. 例如p:first-child:first-letter不起作用hyphens:auto也不起作用。 Are there workarounds to add hyphens to margined text? 有没有变通方法来在页边距文本中添加连字符?

PS trying Hyphenator.js now, but there is a problem with it, since can't find the way to include local script into the page in webbrowser control(im using NavigateToString). PS现在尝试使用Hyphenator.js ,但是存在问题,因为找不到在Webbrowser控件中将本地脚本包含到页面中的方法(即使用NavigateToString)。

You can reference local javascript files, but you need to load them into Isolated Storage first. 您可以引用本地javascript文件,但需要先将其加载到独立存储中。

This is how you can load them into local storage. 这样可以将它们加载到本地存储中。

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);
        }
    }
}

} }

Then you can reference them like so: 然后,您可以像这样引用它们:

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

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

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