protected void Application_Start()
        {
            using (new PerformanceMonitor())
            {
                TableRegister.Initialize();

                logger.Log("Application Start Called.");

                var  app      = new Admin.Application();
                bool loggedOn = app.LogOn();

                logger.Log("Logged On: {0}".FormatWithCulture(loggedOn));

                FederatedAuthentication.ServiceConfigurationCreated += this.OnServiceConfigurationCreated;

                AreaRegistration.RegisterAllAreas();

                Contract.Assume(null != GlobalFilters.Filters);
                RegisterGlobalFilters(GlobalFilters.Filters);

                Contract.Assume(null != RouteTable.Routes);
                RegisterRoutes(RouteTable.Routes);

                logger.Log("Application Started.");
            }
        }
Beispiel #2
0
        public CPU()
        {
            PMode            = false;
            segments         = new Segment[6];
            registers        = new Register[9];
            controlRegisters = new uint[5];
            idtRegister      = new TableRegister();
            gdtRegister      = new TableRegister();
            disasm           = new Disassembler(DisassemblerRead);

            disasm.CodeSize = codeSize;
            ProcessOperations();
            realModeEntry = new GDTEntry
            {
                BaseAddress = 0,
                Is32Bit     = false,
                IsAccessed  = true,
                IsCode      = false,
                Limit       = 0xffff,
                IsWritable  = true
            };

            Halted = false;

            interruptOperand      = new Operand();
            interruptOperand.Size = 8;
            interruptOperand.Type = OperandType.Immediate;

            Reset();
        }
Beispiel #3
0
        public CPU()
        {
            PMode = false;
            segments = new Segment[6];
            registers = new Register[9];
            controlRegisters = new uint[5];
            idtRegister = new TableRegister();
            gdtRegister = new TableRegister();
            disasm = new Disassembler(DisassemblerRead);

            disasm.CodeSize = codeSize;
            ProcessOperations();
            realModeEntry = new GDTEntry
                                {
                                    BaseAddress = 0,
                                    Is32Bit = false,
                                    IsAccessed = true,
                                    IsCode = false,
                                    Limit = 0xffff,
                                    IsWritable = true
                                };

            Halted = false;

            interruptOperand = new Operand();
            interruptOperand.Size = 8;
            interruptOperand.Type = OperandType.Immediate;

            Reset();
        }
Beispiel #4
0
 public TrueTypeFont(decimal version, IReadOnlyDictionary <string, TrueTypeHeaderTable> tableHeaders, TableRegister tableRegister)
 {
     Version       = version;
     TableHeaders  = tableHeaders;
     TableRegister = tableRegister ?? throw new ArgumentNullException(nameof(tableRegister));
     HeaderTable   = tableRegister.HeaderTable;
     CMapTable     = tableRegister.CMapTable;
     GlyphTable    = tableRegister.GlyphDataTable;
 }
Beispiel #5
0
        protected void Application_Start()
        {
            using (new PerformanceMonitor())
            {
                TableRegister.Initialize();

                this.log.Log("Application Start Called.");

                var  app      = new Abc.Underpinning.Administration.Application();
                bool loggedOn = app.LogOn();

                this.log.Log("Logged On: {0}".FormatWithCulture(loggedOn));

                this.log.Log("Application Started.");
            }
        }
Beispiel #6
0
        public static void Init(TestContext context)
        {
            Settings.Instance.Add(new TestConfig());

            backend = new AzureComputeEmulator("\\Abc.Cloud.Backend");
            backend.Run();

            frontend = new AzureComputeEmulator("\\Abc.Host.Cloud");
            frontend.Run();

            TableRegister.Initialize();

            var loggedOn = false;
            var i        = 0;

            while (i < 10 && !loggedOn)
            {
                loggedOn = Application.LogOn();
                i++;
            }

            if (!loggedOn)
            {
                throw new ApplicationException("Application not validated.");
            }

            var app = new Abc.Underpinning.Administration.Application();

            loggedOn = false;
            i        = 0;
            while (i < 10 && !loggedOn)
            {
                loggedOn = app.LogOn();
                i++;
            }

            if (!loggedOn)
            {
                throw new ApplicationException("Application not validated.");
            }

            DeleteData();
        }
Beispiel #7
0
        /// <summary>
        /// Application Start
        /// </summary>
        protected void Application_Start()
        {
            using (new PerformanceMonitor())
            {
                TableRegister.Initialize();

                logger.Log("Application Start Called.");

                var  app      = new Admin.Application();
                bool loggedOn = app.LogOn();

                logger.Log(string.Format("Logged On: {0}", loggedOn));

                AreaRegistration.RegisterAllAreas();

                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
                AuthConfig.RegisterAuth();

                logger.Log("Application Started.");
            }
        }
        public static GlyphDataTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, TableRegister tableRegister)
        {
            data.Seek(table.Offset);

            var indexToLocationTable = tableRegister.IndexToLocationTable;

            var offsets = indexToLocationTable.GlyphOffsets;

            var entryCount = offsets.Length;

            var glyphCount = entryCount - 1;

            var glyphs = new IGlyphDescription[glyphCount];

            var emptyGlyph = Glyph.Empty(tableRegister.HeaderTable.Bounds);

            var compositeLocations = new Dictionary <int, TemporaryCompositeLocation>();

            for (var i = 0; i < glyphCount; i++)
            {
                if (offsets[i] == offsets[i + 1])
                {
                    // empty glyph
                    glyphs[i] = emptyGlyph;
                    continue;
                }

                data.Seek(offsets[i] + table.Offset);

                var contourCount = data.ReadSignedShort();

                var minX = data.ReadSignedShort();
                var minY = data.ReadSignedShort();
                var maxX = data.ReadSignedShort();
                var maxY = data.ReadSignedShort();

                var bounds = new PdfRectangle(minX, minY, maxX, maxY);

                // If the number of contours is greater than or equal zero it's a simple glyph.
                if (contourCount >= 0)
                {
                    glyphs[i] = ReadSimpleGlyph(data, contourCount, bounds);
                }
                else
                {
                    compositeLocations.Add(i, new TemporaryCompositeLocation(data.Position, bounds, contourCount));
                }
            }

            // Build composite glyphs by combining simple and other composite glyphs.
            foreach (var compositeLocation in compositeLocations)
            {
                glyphs[compositeLocation.Key] = ReadCompositeGlyph(data, compositeLocation.Value, compositeLocations, glyphs, emptyGlyph);
            }

            return(new GlyphDataTable(table, glyphs));
        }
        public static HorizontalMetricsTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, TableRegister tableRegister)
        {
            var metricCount = tableRegister.HorizontalHeaderTable.NumberOfHeaderMetrics;
            var glyphCount  = tableRegister.MaximumProfileTable.NumberOfGlyphs;

            data.Seek(table.Offset);

            // The number of entries in the left side bearing field per entry is number of glyphs - number of metrics
            var additionalLeftSideBearingLength = glyphCount - metricCount;

            var advancedWidths = new int[metricCount];

            // For bearings over the metric count, the width is the same as the last width in advanced widths.
            var leftSideBearings = new short[glyphCount];

            for (var i = 0; i < metricCount; i++)
            {
                advancedWidths[i]   = data.ReadUnsignedShort();
                leftSideBearings[i] = data.ReadSignedShort();
            }

            for (var i = 0; i < additionalLeftSideBearingLength; i++)
            {
                leftSideBearings[metricCount + i] = data.ReadSignedShort();
            }

            return(new HorizontalMetricsTable(table, advancedWidths, leftSideBearings));
        }
Beispiel #10
0
 public TrueTypeFontProgram(decimal version, IReadOnlyDictionary <string, TrueTypeHeaderTable> tableHeaders, TableRegister tableRegister)
 {
     Version       = version;
     TableHeaders  = tableHeaders;
     TableRegister = tableRegister ?? throw new ArgumentNullException(nameof(tableRegister));
 }
Beispiel #11
0
        public static GlyphDataTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, TableRegister tableRegister)
        {
            data.Seek(table.Offset);

            var headerTable          = tableRegister.HeaderTable;
            var indexToLocationTable = tableRegister.IndexToLocationTable;

            var offsets = indexToLocationTable.GlyphOffsets;

            var entryCount = offsets.Length;

            var glyphCount = entryCount - 1;

            var glyphs = new IGlyphDescription[glyphCount];

            for (var i = 0; i < glyphCount; i++)
            {
                if (offsets[i] == offsets[i + 1])
                {
                    // empty glyph
                    continue;
                }

                data.Seek(offsets[i] + table.Offset);

                var contourCount = data.ReadSignedShort();

                var minX = data.ReadSignedShort();
                var minY = data.ReadSignedShort();
                var maxX = data.ReadSignedShort();
                var maxY = data.ReadSignedShort();

                var bounds = new PdfRectangle(minX, minY, maxX, maxY);

                // If the number of contours is greater than or equal zero it's a simple glyph.
                if (contourCount >= 0)
                {
                    glyphs[i] = ReadSimpleGlyph(data, contourCount, bounds);
                }
                else
                {
                }
            }

            return(new GlyphDataTable(table, glyphs));
        }
Beispiel #12
0
        public static IndexToLocationTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, TableRegister tableRegister)
        {
            const short shortFormat = 0;
            const short longFormat  = 1;

            data.Seek(table.Offset);

            var headerTable         = tableRegister.HeaderTable;
            var maximumProfileTable = tableRegister.MaximumProfileTable;

            var format = headerTable.IndexToLocFormat;

            var glyphCount = maximumProfileTable.NumberOfGlyphs + 1;

            var offsets = new long[glyphCount];

            switch (format)
            {
            case shortFormat:
            {         // The local offset divided by 2 is stored.
                for (int i = 0; i < glyphCount; i++)
                {
                    offsets[i] = data.ReadUnsignedShort() * 2;
                }
                break;
            }

            case longFormat:
            {
                // The actual offset is stored.
                data.ReadUnsignedIntArray(offsets, glyphCount);
                break;
            }

            default:
                throw new InvalidOperationException($"The format {format} was invalid for the index to location (loca) table.");
            }


            return(new IndexToLocationTable(table, offsets));
        }
Beispiel #13
0
        public static CMapTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, TableRegister tableRegister)
        {
            data.Seek(table.Offset);

            var tableVersionNumber = data.ReadUnsignedShort();

            var numberOfEncodingTables = data.ReadUnsignedShort();

            var subTableHeaders = new SubTableHeaderEntry[numberOfEncodingTables];

            for (int i = 0; i < numberOfEncodingTables; i++)
            {
                var platformId = data.ReadUnsignedShort();
                var encodingId = data.ReadUnsignedShort();
                var offset     = data.ReadUnsignedInt();

                subTableHeaders[i] = new SubTableHeaderEntry(platformId, encodingId, offset);
            }

            var tables = new List <ICMapSubTable>(numberOfEncodingTables);

            var numberofGlyphs = tableRegister.MaximumProfileTable.NumberOfGlyphs;

            for (var i = 0; i < subTableHeaders.Length; i++)
            {
                var header = subTableHeaders[i];

                data.Seek(table.Offset + header.Offset);

                var format = data.ReadUnsignedShort();

                /*
                 * There are 9 currently available formats:
                 * 0: Character code and glyph indices are restricted to a single byte. Rare.
                 * 2: Suitable for CJK characters. Contain mixed 8/16 byte encoding.
                 * 4: 2 byte encoding format. Used when character codes fall into (gappy) contiguous ranges.
                 * 6: 'Trimmed table mapping', used when character codes fall into a single contiguous range. This is dense mapping.
                 * 8: 16/32 bit coverage. Uses mixed length character codes.
                 * 10: Similar to format 6, trimmed table/array for 32 bits.
                 * 12: Segmented coverage, similar to format 4 but for 32 bit/4 byte.
                 * 13: Many to one mappings. Used by Apple for the LastResort font.
                 * 14: Unicode variation sequences.
                 *
                 * Many of the formats are obsolete or not really used. Modern fonts will tend to use formats 4, 6 and 12.
                 * For PDF we will support 0, 2 and 4 since these are in the original TrueType spec.
                 */
                switch (format)
                {
                case 0:
                {
                    // Simple 1 to 1 mapping of character codes to glyph codes.
                    var item = ByteEncodingCMapTable.Load(data, header.PlatformId, header.EncodingId);
                    tables.Add(item);
                    break;
                }

                case 2:
                {
                    // Useful for CJK characters. Use mixed 8/16 bit encoding.
                    var item = HighByteMappingCMapTable.Load(data, numberofGlyphs, header.PlatformId, header.EncodingId);
                    tables.Add(item);
                    break;
                }

                case 4:
                {
                    // Microsoft's standard mapping table.
                    var item = Format4CMapTable.Load(data, header.PlatformId, header.EncodingId);
                    tables.Add(item);
                    break;
                }

                case 6:
                {
                    var item = TrimmedTableMappingCMapTable.Load(data, header.PlatformId, header.EncodingId);
                    tables.Add(item);
                    break;
                }
                }
            }

            return(new CMapTable(tableVersionNumber, table, tables));
        }
Beispiel #14
0
        /// <summary>
        /// Create a new <see cref="TrueTypeFont"/>.
        /// </summary>
        internal TrueTypeFont(float version, IReadOnlyDictionary <string, TrueTypeHeaderTable> tableHeaders, TableRegister tableRegister)
        {
            Version        = version;
            TableHeaders   = tableHeaders ?? throw new ArgumentNullException(nameof(tableHeaders));
            TableRegister  = tableRegister ?? throw new ArgumentNullException(nameof(tableRegister));
            NumberOfTables = tableHeaders.Count;

            if (TableRegister.CMapTable != null)
            {
                const int encodingSymbol   = 0;
                const int encodingUnicode  = 1;
                const int encodingMacRoman = 0;

                foreach (var subTable in TableRegister.CMapTable.SubTables)
                {
                    if (WindowsSymbolCMap == null &&
                        subTable.PlatformId == TrueTypeCMapPlatform.Windows &&
                        subTable.EncodingId == encodingSymbol)
                    {
                        WindowsSymbolCMap = subTable;
                    }
                    else if (WindowsUnicodeCMap == null &&
                             subTable.PlatformId == TrueTypeCMapPlatform.Windows &&
                             subTable.EncodingId == encodingUnicode)
                    {
                        WindowsUnicodeCMap = subTable;
                    }
                    else if (MacRomanCMap == null &&
                             subTable.PlatformId == TrueTypeCMapPlatform.Macintosh &&
                             subTable.EncodingId == encodingMacRoman)
                    {
                        MacRomanCMap = subTable;
                    }
                }
            }
        }