Example #1
0
        /// <summary>
        /// Retrieve the <see cref="FTSize"/> object that corresponds to a given <see cref="Scaler"/> pointer through a
        /// cache manager.
        /// </summary>
        /// <remarks><para>
        /// The returned <see cref="FTSize"/> object is always owned by the/ manager. You should never try to discard
        /// it by yourself.
        /// </para><para>
        /// You can access the parent <see cref="Face"/> object simply as <see cref="FTSize.Face"/> if you need it.
        /// Note that this object is also owned by the manager.
        /// </para><para>
        /// When you perform a lookup, out-of-memory errors are detected within the lookup and force incremental
        /// flushes of the cache until enough memory is released for the lookup to succeed.
        /// </para><para>
        /// If a lookup fails with <see cref="Error.OutOfMemory"/> the cache has already been completely flushed, and
        /// still no memory is available for the operation.
        /// </para></remarks>
        /// <param name="scaler">A scaler handle.</param>
        /// <returns>A handle to the size object.</returns>
        public FTSize LookupSize(Scaler scaler)
        {
            Error err = FT.FTC_Manager_LookupSize(Reference, scaler.Reference, out var sizeRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            //HACK fix this later.
            return(new FTSize(sizeRef, false, null));
        }
Example #2
0
        /// <summary>
        /// A variant of <see cref="ImageCache.Lookup"/> that uses a <see cref="Scaler"/> to specify the face ID and its
        /// size.
        /// </summary>
        /// <remarks><para>
        /// The returned glyph is owned and managed by the glyph image cache. Never try to transform or discard it
        /// manually! You can however create a copy with <see cref="Glyph.Copy"/> and modify the new one.
        /// </para><para>
        /// If ‘node’ is not NULL, it receives the address of the cache node containing the glyph image,
        /// after increasing its reference count. This ensures that the node (as well as the <see cref="Glyph"/>) will
        /// always be kept in the cache until you call <see cref="Node.Unref"/> to ‘release’ it.
        /// </para><para>
        /// If ‘node’ is NULL, the cache node is left unchanged, which means that the <see cref="Glyph"/>
        /// could be flushed out of the cache on the next call to one of the caching sub-system APIs. Don't assume that
        /// it is persistent!
        /// </para><para>
        /// Calls to <see cref="Face.SetCharSize"/> and friends have no effect on cached glyphs; you should always use
        /// the FreeType cache API instead.
        /// </para></remarks>
        /// <param name="scaler">A pointer to a scaler descriptor.</param>
        /// <param name="loadFlags">The corresponding load flags.</param>
        /// <param name="gIndex">The glyph index to retrieve.</param>
        /// <param name="node">
        /// Used to return the address of of the corresponding cache node after incrementing its reference count (see
        /// note below).
        /// </param>
        /// <returns>The corresponding <see cref="Glyph"/> object. 0 in case of failure.</returns>
        public Glyph LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node)
        {
            if (parentManager.IsDisposed)
            {
                throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
            }

            Error err = FT.FTC_ImageCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out var glyphRef, out var nodeRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            node = new Node(nodeRef);
            return(new Glyph(glyphRef, null));
        }
Example #3
0
        /// <summary>
        /// Retrieve the <see cref="FTSize"/> object that corresponds to a given <see cref="Scaler"/> pointer through a
        /// cache manager.
        /// </summary>
        /// <remarks><para>
        /// The returned <see cref="FTSize"/> object is always owned by the/ manager. You should never try to discard
        /// it by yourself.
        /// </para><para>
        /// You can access the parent <see cref="Face"/> object simply as <see cref="FTSize.Face"/> if you need it.
        /// Note that this object is also owned by the manager.
        /// </para><para>
        /// When you perform a lookup, out-of-memory errors are detected within the lookup and force incremental
        /// flushes of the cache until enough memory is released for the lookup to succeed.
        /// </para><para>
        /// If a lookup fails with <see cref="Error.OutOfMemory"/> the cache has already been completely flushed, and
        /// still no memory is available for the operation.
        /// </para></remarks>
        /// <param name="scaler">A scaler handle.</param>
        /// <returns>A handle to the size object.</returns>
        public FTSize LookupSize(Scaler scaler)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Manager", "Cannot access a disposed object.");
            }

            IntPtr sizeRef;
            Error  err = FT.FTC_Manager_LookupSize(Reference, scaler.Reference, out sizeRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            //HACK fix this later.
            return(new FTSize(sizeRef, false, null));
        }
Example #4
0
        public SBit LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node)
        {
            if (parentManager.IsDisposed)
            {
                throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");
            }

            IntPtr sbitRef, nodeRef;
            Error  err = FT.FTC_SBitCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out sbitRef, out nodeRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            node = new Node(nodeRef);
            return(new SBit(sbitRef));
        }
Example #5
0
        /// <summary>
        /// Retrieve the <see cref="FTSize"/> object that corresponds to a given <see cref="Scaler"/> pointer through a
        /// cache manager.
        /// </summary>
        /// <remarks><para>
        /// The returned <see cref="FTSize"/> object is always owned by the/ manager. You should never try to discard
        /// it by yourself.
        /// </para><para>
        /// You can access the parent <see cref="Face"/> object simply as <see cref="FTSize.Face"/> if you need it.
        /// Note that this object is also owned by the manager.
        /// </para><para>
        /// When you perform a lookup, out-of-memory errors are detected within the lookup and force incremental
        /// flushes of the cache until enough memory is released for the lookup to succeed.
        /// </para><para>
        /// If a lookup fails with <see cref="Error.OutOfMemory"/> the cache has already been completely flushed, and
        /// still no memory is available for the operation.
        /// </para></remarks>
        /// <param name="scaler">A scaler handle.</param>
        /// <returns>A handle to the size object.</returns>
        public FTSize LookupSize(Scaler scaler)
        {
            if (disposed)
                throw new ObjectDisposedException("Manager", "Cannot access a disposed object.");

            IntPtr sizeRef;
            Error err = FT.FTC_Manager_LookupSize(Reference, scaler.Reference, out sizeRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            //HACK fix this later.
            return new FTSize(sizeRef, false, null);
        }
Example #6
0
        public Glyph LookupScaler(Scaler scaler, LoadFlags loadFlags, uint gIndex, out Node node)
        {
            if (parentManager.IsDisposed)
                throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");

            IntPtr glyphRef, nodeRef;
            Error err = FT.FTC_ImageCache_LookupScaler(Reference, scaler.Reference, loadFlags, gIndex, out glyphRef, out nodeRef);

            if (err != Error.Ok)
                throw new FreeTypeException(err);

            node = new Node(nodeRef);
            return new Glyph(glyphRef, null);
        }