AddRelationship( ) { if (!_curPageRelAdded && CurrentPageReferences) { FontEmbeddingAction action = XpsFontSubsetter.DetermineEmbeddingAction(_glyphTypeface); switch (action) { case FontEmbeddingAction.ImageOnlyFont: break; case FontEmbeddingAction.ObfuscateOnlyFont: case FontEmbeddingAction.ObfuscateSubsetFont: _packagingPolicy. RelateResourceToCurrentPage( _fontResourceStream.Uri, XpsS0Markup.ResourceRelationshipName); break; } } // Now we are finished with the current page // and need flag the need for relationship on the next _curPageRelAdded = false; }
AddGlyphRunUsage( GlyphRun glyphRun ) { Uri fontUri = null; FontEmbeddingAction action = XpsFontSubsetter.DetermineEmbeddingAction(_glyphTypeface); switch (action) { // // Provide an empty image stream. The Glyphs serializer // will check content type and render adn serialize an // image into this stream based on content type // case FontEmbeddingAction.ImageOnlyFont: break; case FontEmbeddingAction.ObfuscateOnlyFont: fontUri = _fontResourceStream.Uri; // nothing to do here since the entire font will be added break; case FontEmbeddingAction.ObfuscateSubsetFont: _fontEmbeddingManager.RecordUsage(glyphRun); fontUri = _fontResourceStream.Uri; break; } return(fontUri); }
AddRestrictedRelationship( ) { FontEmbeddingAction action = XpsFontSubsetter.DetermineEmbeddingAction(_glyphTypeface); if (action != FontEmbeddingAction.ImageOnlyFont && XpsFontSubsetter.IsRestrictedFont(_glyphTypeface)) { _packagingPolicy. RelateRestrictedFontToCurrentDocument( _fontResourceStream.Uri ); } }
AddGlyphRunUsage( GlyphRun glyphRun ) { Uri fontUri = null; FontEmbeddingAction action = XpsFontSubsetter.DetermineEmbeddingAction(_glyphTypeface); switch (action) { // // Provide an empty image stream. The Glyphs serializer // will check content type and render adn serialize an // image into this stream based on content type // case FontEmbeddingAction.ImageOnlyFont: break; case FontEmbeddingAction.ObfuscateOnlyFont: fontUri = _fontResourceStream.Uri; // nothing to do here since the entire font will be added break; case FontEmbeddingAction.ObfuscateSubsetFont: CodeAccessPermission uriDiscoveryPermission = glyphRun.GlyphTypeface.CriticalUriDiscoveryPermission; if (uriDiscoveryPermission != null) { uriDiscoveryPermission.Assert(); } try { _fontEmbeddingManager.RecordUsage(glyphRun); } finally { if (uriDiscoveryPermission != null) { CodeAccessPermission.RevertAssert(); } } fontUri = _fontResourceStream.Uri; break; } return(fontUri); }
Commit( ) { FontEmbeddingAction action = XpsFontSubsetter.DetermineEmbeddingAction(_glyphTypeface); switch (action) { case FontEmbeddingAction.ImageOnlyFont: // nothing to do here since the glyph runs have already been converted break; case FontEmbeddingAction.ObfuscateOnlyFont: CopyFontStream(); break; case FontEmbeddingAction.ObfuscateSubsetFont: SubSetFont( _fontEmbeddingManager.GetUsedGlyphs(_fontUri), _fontResourceStream.Stream ); break; } }