API java : FontRenderContext


java.awt.font
Class FontRenderContext

java.lang.Object
  extended by java.awt.font.FontRenderContext

public class FontRenderContext
extends Object

The FontRenderContext class is a container for the information needed to correctly measure text. The measurement of text can vary because of rules that map outlines to pixels, and rendering hints provided by an application.

One such piece of information is a transform that scales typographical points to pixels. (A point is defined to be exactly 1/72 of an inch, which is slightly different than the traditional mechanical measurement of a point.) A character that is rendered at 12pt on a 600dpi device might have a different size than the same character rendered at 12pt on a 72dpi device because of such factors as rounding to pixel boundaries and hints that the font designer may have specified.

Anti-aliasing and Fractional-metrics specified by an application can also affect the size of a character because of rounding to pixel boundaries.

Typically, instances of FontRenderContext are obtained from a Graphics2D object. A FontRenderContext which is directly constructed will most likely not represent any actual graphics device, and may lead to unexpected or incorrect results.

See Also:
RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.KEY_FRACTIONALMETRICS, Graphics2D.getFontRenderContext(), LineMetrics

Constructor Summary
protected FontRenderContext()
          Constructs a new FontRenderContext object.
  FontRenderContext(AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics)
          Constructs a FontRenderContext object from an optional AffineTransform and two boolean values that determine if the newly constructed object has anti-aliasing or fractional metrics.
 
Method Summary
 boolean equals(FontRenderContext rhs)
          Return true if rhs has the same transform, antialiasing, and fractional metrics values as this.
 boolean equals(Object obj)
          Return true if obj is an instance of FontRenderContext and has the same transform, antialiasing, and fractional metrics values as this.
 AffineTransform getTransform()
          Gets the transform that is used to scale typographical points to pixels in this FontRenderContext.
 int hashCode()
          Return a hashcode for this FontRenderContext.
 boolean isAntiAliased()
          Gets the text anti-aliasing mode used in this FontRenderContext.
 boolean usesFractionalMetrics()
          Gets the text fractional metrics mode requested by the application for use in this FontRenderContext.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontRenderContext

protected FontRenderContext()
Constructs a new FontRenderContext object.


FontRenderContext

public FontRenderContext(AffineTransform tx,
                         boolean isAntiAliased,
                         boolean usesFractionalMetrics)
Constructs a FontRenderContext object from an optional AffineTransform and two boolean values that determine if the newly constructed object has anti-aliasing or fractional metrics.

Parameters:
tx - the transform which is used to scale typographical points to pixels in this FontRenderContext. If null, an identity tranform is used.
isAntiAliased - determines if the newly contructed object has anti-aliasing
usesFractionalMetrics - determines if the newly constructed object uses fractional metrics
Method Detail

getTransform

public AffineTransform getTransform()
Gets the transform that is used to scale typographical points to pixels in this FontRenderContext.

Returns:
the AffineTransform of this FontRenderContext.
See Also:
AffineTransform

isAntiAliased

public boolean isAntiAliased()
Gets the text anti-aliasing mode used in this FontRenderContext.

Returns:
true, if text is anti-aliased in this FontRenderContext; false otherwise.
See Also:
RenderingHints.KEY_TEXT_ANTIALIASING

usesFractionalMetrics

public boolean usesFractionalMetrics()
Gets the text fractional metrics mode requested by the application for use in this FontRenderContext.

Returns:
true, if layout should be performed with fractional metrics; false otherwise. in this FontRenderContext.
See Also:
RenderingHints.KEY_FRACTIONALMETRICS

equals

public boolean equals(Object obj)
Return true if obj is an instance of FontRenderContext and has the same transform, antialiasing, and fractional metrics values as this.

Overrides:
equals in class Object
Parameters:
obj - the object to test for equality
Returns:
true if the specified object is equal to this FontRenderContext; false otherwise.
See Also:
Object.hashCode(), Hashtable

equals

public boolean equals(FontRenderContext rhs)
Return true if rhs has the same transform, antialiasing, and fractional metrics values as this.

Parameters:
rhs - the FontRenderContext to test for equality
Returns:
true if rhs is equal to this FontRenderContext; false otherwise.

hashCode

public int hashCode()
Return a hashcode for this FontRenderContext.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

8 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-751
Document créé le 25/07/06 17:49, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-java/awt/font/FontRenderContext.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
2,11 secondes

Mises à jour :
Mises à jour du site
Citation (masquer)
Il faut se garder de trois fautes : parler sans y être invité, ce qui est impertinence ; ne pas parler quand on y est invité, ce qui est de la dissimulation ; parler sans observer les réactions de l'autre, ce qui est de l'aveuglement.

Confucius
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 14:44, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)