Skip to content

Commit

Permalink
Add Windows Phone (not implemented)
Browse files Browse the repository at this point in the history
  • Loading branch information
eb1 committed Dec 8, 2014
1 parent f330c6e commit def8f15
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
18 changes: 18 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,22 @@
</config-file>
<source-file src="src/android/Fonts.java" target-dir="src/org/adapt-it/Fonts" />
</platform>
<!-- wp7 -->
<platform name="wp7">
<config-file target="config.xml" parent="/*">
<feature name="Fonts">
<param name="wp-package" value="Fonts"/>
</feature>
</config-file>
<source-file src="src/wp/Fonts.cs" />
</platform>
<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="Fonts">
<param name="wp-package" value="Fonts"/>
</feature>
</config-file>
<source-file src="src/wp/Fonts.cs" />
</platform>
</plugin>
62 changes: 62 additions & 0 deletions src/wp/Fonts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Runtime.Serialization;

namespace WPCordovaClassLib.Cordova.Commands
{
/// <summary>
/// Provides information about system locale, culture settings, number formats, ect.
/// </summary>
public class Fonts : BaseCommand
{
/// <summary>
/// Gets the string identifier for the client's current language.
/// </summary>
/// <param name="options"></param>
public void getPreferredLanguage(string options)
{
try
{
var language = CultureInfo.CurrentUICulture.Name;
PluginResult result = new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(language));
this.DispatchCommandResult(result);
}
catch (Exception)
{
this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
}
}


FontFamily fontFamily = new FontFamily("Arial");
Font font = new Font(
fontFamily,
8,
FontStyle.Regular,
GraphicsUnit.Point);
RectangleF rectF = new RectangleF(10, 10, 500, 500);
SolidBrush solidBrush = new SolidBrush(Color.Black);

string familyName;
string familyList = "";
FontFamily[] fontFamilies;

InstalledFontCollection installedFontCollection = new InstalledFontCollection();

// Get the array of FontFamily objects.
fontFamilies = installedFontCollection.Families;

// The loop below creates a large string that is a comma-separated
// list of all font family names.

int count = fontFamilies.Length;
for (int j = 0; j < count; ++j)
{
familyName = fontFamilies[j].Name;
familyList = familyList + familyName;
familyList = familyList + ", ";
}

// Draw the large string (list of all families) in a rectangle.
e.Graphics.DrawString(familyList, font, solidBrush, rectF);
}
}

0 comments on commit def8f15

Please sign in to comment.