Пример #1
0
        /*!
         * \brief
         *  Creates a Pixmap type font.
         *
         * \param font_name
         *  The name that the font will use within the CEGUI system.
         *
         * \param imageset_filename
         *  The filename of an imageset to load that will be used as the source for
         *  glyph images for this font.  If \a resource_group is the special value
         *  of "*", this parameter may instead refer to the name of an already
         *  loaded Imagset.
         *
         * \param resource_group
         *  The resource group identifier to use when loading the imageset file
         *  specified by \a imageset_filename.  If this group is set to the special
         *  value of "*", then \a imageset_filename instead will refer to the name
         *  of an existing Imageset.
         *
         * \param auto_scaled
         *  Specifies whether the font imagery should be automatically scaled to
         *  maintain the same physical size (which is calculated by using the
         *  native resolution setting).
         *
         * \param native_horz_res
         *  The horizontal native resolution value.  This is only significant when
         *  auto scaling is enabled.
         *
         * \param native_vert_res
         *  The vertical native resolution value.  This is only significant when
         *  auto scaling is enabled.
         *
         * \param action
         *  One of the XMLResourceExistsAction enumerated values indicating what
         *  action should be taken when a Font with the specified name
         *  already exists.
         *
         * \return
         *  Reference to the newly create Font object.
         */
        public Font CreatePixmapFont(string font_name,
                                     string imageset_filename,
                                     string resource_group,
                                     AutoScaledMode auto_scaled,
                                     Sizef native_res,
                                     XMLResourceExistsAction action)
        {
            Logger.LogInsane("Attempting to create Pixmap font '" + font_name + "' using imageset file '" + imageset_filename + "'.");

            // create new object ahead of time
            Font @object = new PixmapFont(font_name, imageset_filename, resource_group, auto_scaled, native_res);

            // return appropriate object instance (deleting any not required)
            return(DoExistingObjectAction(font_name, @object, action));
        }
Пример #2
0
        /// <summary>
        /// creates a PixmapFont
        /// </summary>
        /// <param name="attributes"></param>
        private void CreatePixmapFont(XMLAttributes attributes)
        {
            var name          = attributes.GetValueAsString(FontNameAttribute);
            var filename      = attributes.GetValueAsString(FontFilenameAttribute);
            var resourceGroup = attributes.GetValueAsString(FontResourceGroupAttribute);

            Logger.LogInsane("---- CEGUI font name: " + name);
            Logger.LogInsane("----       Font type: Pixmap");
            Logger.LogInsane("----     Source file: " + filename + " in resource group: " + (String.IsNullOrEmpty(resourceGroup) ? "(Default)" : resourceGroup));

            _font = new PixmapFont(
                name, filename, resourceGroup,
                PropertyHelper.FromString <AutoScaledMode>(attributes.GetValueAsString(FontAutoScaledAttribute)),
                new Sizef(attributes.GetValueAsFloat(FontNativeHorzResAttribute, 640.0f),
                          attributes.GetValueAsFloat(FontNativeVertResAttribute, 480.0f)));
        }