<%@ page import = "com.cyscape.browserhawk.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.util.*" %>

<!--
   This file is provided under the terms of the BrowserHawk4J license
   agreement.  Copyright (c) 2004-2006 cyScape, Inc. All rights reserved.
-->

<%
  // First we make sure the system executing this example has an
  // Enterprise Edition license as required for this test.
  // Note: This is NOT needed in your pages, only for this sample.
  if (BrowserHawk.getVersion().indexOf("Ent") == -1) {
    out.println("Enterprise License Required.  ");
    out.println("You are using " + BrowserHawk.getVersion() + ".  ");
    out.println("See <a href='http://www.cyscape.com/order/'>http://www.cyscape.com/order/</a> for upgrade information.");
    return;
  }

  String fonts = "Arial";

  ExtendedOptions options = new ExtendedOptions();
  options.addProperty("FontsInstalled");
  options.setFontsToCheck(fonts);

  options.setPageMessage("Checking your browser. Please wait...");
  options.setBodyTag("BGCOLOR=#FFFFFF");
  options.setPageTitle("Please wait...");

  BrowserInfo info = BrowserHawk.getBrowserInfo(request);
  ExtendedBrowserInfo einfo = null;
  try {
    einfo = BrowserHawk.getExtendedBrowserInfo(request, response, options);
  }
  catch (Exception e) {
    PrintWriter pw = new PrintWriter(out, true);
    pw.println("<pre>");
    e.printStackTrace(pw);
    pw.println("</pre>");
    return;
  }
  // A null return value indicates JavaScript has been sent and 
  // we should immediately return
  if (einfo == null) return;
%>

<html>
<head><title>Font Test Page</title></head>

<body bgcolor=white>
<font face="helvetica">

<h2>Font Test Page</h2>

<% if (einfo == ExtendedBrowserInfo.UNSUPPORTED) { %>
  <big>No extended information is available.  Only Netscape,
  Mozilla, Firefox, IE, Opera, Safari, and AOLBrowser clients 
  are supported.</big>
<% } else if (einfo.getJavaScriptEnabled() == false) { %>
  <big>No extended information is available.  This client has
  JavaScript disabled.</big>
<% } else if (!info.getBrowser().equals("IE") || !(info.getVersion() > 5)) { %>
  <big>No font detection is available.  Your browser has to be IE on Windows or
  Mac version 5 or later.</big>
<% } else { %>

This example tests if your browser has "Arial" installed.<br>

<br>

<table>
<tr><th align="left">Font Name</th><th>Installed</th></tr>
<tr><td width="150"><font face="Arial">Arial</font></td>
        <td><%= einfo.getFontInstalled("Arial") %></td></tr>
</table>

<% } %>

<P>
<b><a href="fontcheck_basic.jsp">Retry this test</a></b><P>
<b><a href="index.html">Return to list of other JSP samples</a></b><P>
<b><a href="http://www.cyscape.com/order/">BrowserHawk Pricing and Ordering</a></b><P>
<b><a href="http://www.cyscape.com/">cyScape home page</a></b><P>
</font>
</body>
</html>
