当前位置: 首页>>代码示例>>C#>>正文


C# CairoContextEx.SetPangoFontSize方法代码示例

本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.SetPangoFontSize方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.SetPangoFontSize方法的具体用法?C# CairoContextEx.SetPangoFontSize怎么用?C# CairoContextEx.SetPangoFontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gbrainy.Core.Main.CairoContextEx的用法示例。


在下文中一共展示了CairoContextEx.SetPangoFontSize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            gr.Scale (area_width, area_height);

            gr.LineWidth = 0.01;
            gr.Color = new Cairo.Color (0, 0, 0, 1);

            gr.SetPangoLargeFontSize ();
            gr.DrawTextCentered (0.5, 0.1, ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Get ready to memorize the next objects..."));
            gr.Stroke ();

            gr.SetPangoFontSize (0.35);
            gr.DrawTextCentered (0.5, 0.5, countdown_time.ToString ());
            gr.Stroke ();

            gr.Arc (0.5, 0.5, 0.25, 0, 2 * Math.PI);
            gr.Stroke ();
            gr.Arc (0.5, 0.5, 0.28, 0, 2 * Math.PI);
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:20,代码来源:CountDownView.cs

示例2: GenerateAnswers

        static void GenerateAnswers(CairoContextEx cr, Game [] games, int columns, int rows)
        {
            int x, y, page;
            string str;
            int column, row;
            const int space_lines = 80;

            x = y = page = 0;
            column = row = 0;

            // Draw solution title
            cr.SetPangoFontSize (20);
            cr.DrawStringWithWrapping (x + margin, y + margin,
                ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Solutions"), width - margin);
            y += space_lines;
            cr.Stroke ();

            cr.SetPangoFontSize (12);
            cr.UseMarkup = true;
            for (int i = 0; i < games.Length; i++)
            {
                str = String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Game #{0}. {1}"), i + 1, games[i].AnswerText);

                // Draw Solution
                cr.DrawStringWithWrapping (x + margin, y + margin, str, width - margin);
                cr.Stroke ();

                y += space_lines;

                // Next lateral page (right)
                if (y + space_lines >= page_height * (row + 1) && x + page_width < page_width * columns) {
                    column++;

                    x = column * page_width;
                    y = row * page_height;
                    page++;
                } else {
                    // No more space (right), new row
                    if (y + space_lines >= page_height * (row + 1) && x + page_width >= page_width * columns) {
                        row++;
                        column = 0;

                        x = column * page_width;
                        y = row * page_height;
                        page++;
                    }
                }

                if (page >= rows * columns) {
                    cr.ShowPage ();
                    page = x = y = 0;
                    column = row = 0;
                }
            }

            if (y > 0)
                cr.ShowPage ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:58,代码来源:PdfExporter.cs

示例3: GenerateQuestions

        static void GenerateQuestions(CairoContextEx cr, Game [] games, int columns, int rows)
        {
            int x, y, page;
            Game puzzle;
            string str;

            x = y = page = 0;
            for (int i = 0; i < games.Length; i++)
            {
                puzzle = games [i];
                puzzle.Begin ();
                page++;

                cr.Save ();
                cr.Translate (x, y);
                cr.Rectangle (0, 0, width, height + question_height);
                cr.Clip ();

                // Translators: {0} is the game number and {1} the game question or answer
                // The number is used as reference when looking for the game solution in the PDF
                str = String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Game #{0}. {1}"), i + 1, puzzle.Question);

                // Draw question
                cr.SetPangoFontSize (12);
                cr.UseMarkup = true;
                cr.DrawStringWithWrapping (margin, 10, str, width - margin);
                cr.Stroke ();
                cr.UseMarkup = false;

                // Draw from question_height up height since from 0 to question_height is the question
                // Translate adds always to previous matrix's transformation
                cr.Translate (0, question_height);
                puzzle.DrawPreview (cr, width, height, false);
                if (i == 0) {
                    cr.Save ();
                    cr.SetPangoFontSize (0.02);
                    cr.MoveTo (0.05, 0.95);
                    cr.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Created by gbrainy {0}"), Defines.VERSION));
                    cr.Stroke ();
                    cr.Restore ();
                }

                x += width + margin;
                if (x > width + margin) {
                    x = 0;
                    y += height + margin + question_height;
                }
                cr.Restore ();
                cr.Stroke ();

                if (page >= columns * rows) {
                    cr.ShowPage ();
                    page = x = y = 0;
                }
            }

            if (y > 0)
                cr.ShowPage ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:59,代码来源:PdfExporter.cs

示例4: Draw

        public void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double y = 0.04, x = 0.05;
            const double space_small = 0.02;
            List <PlayerPersonalRecord> records;
            string s, tip, played;
            double width, height;

            gr.Scale (area_width, area_height);
            gr.Color = new Cairo.Color (0, 0, 0, 1);

            gr.MoveTo (x, y);
            gr.ShowPangoText (Translations.GetString ("Score"), false, -1, 0);
            DrawBand (gr, 0.03, y - 0.01);

            y += 0.08;
            gr.MoveTo (x, y);

            s = session.History.GetResult (Translations);

            // Translator: This will be part of the sentence "Games won: 10 (6 played)"
            played = String.Format (Translations.GetPluralString ("{0} played", "{0} played", session.History.GamesPlayed),
                session.History.GamesPlayed);

            if (s == string.Empty) {
                gr.ShowPangoText (String.Format (Translations.GetPluralString ("Games won: {0} ({1})",
                    "Games won: {0} ({1})", session.History.GamesWon), session.History.GamesWon, played));
            }
            else {
                gr.ShowPangoText (String.Format (Translations.GetPluralString ("{0}. Games won: {1} ({2})",
                    "{0}. Games won: {1} ({2})", session.History.GamesWon),	s, session.History.GamesWon, played));
            }

            y += 0.06;
            gr.MoveTo (x, y);
            gr.ShowPangoText (String.Format (Translations.GetString ("Time played {0} (average per game {1})"), session.GameTime, session.TimePerGame));

            y += 0.09;
            DrawColumnBarGraphic (gr, x, y);

            y += 0.36;
            gr.MoveTo (x, y);
            gr.SetPangoFontSize (smaller_font);
            // Translators: translated string should not be longer that the English original (space restriction on the UI)
            gr.ShowPangoText (Translations.GetString ("For details on how gbrainy's scoring works refer to the help."));

            y += 0.07;
            gr.SetPangoNormalFontSize ();
            records	= session.PlayerHistory.GetLastGameRecords ();
            gr.MoveTo (x, y);

            if (records.Count == 0) {
                bool caching = cached_sessionid != session.ID;

                gr.ShowPangoText (Translations.GetString ("Tips for your next games"), false, -1, 0);
                DrawBand (gr, 0.03, y - 0.01);

                y += 0.08;

                if (caching)
                    tips.Clear ();

                for (int i = 0; i < tips_shown; i++)
                {
                    if (caching)
                        tips.Add (game_tips.Tip);

                    tip = "- " + tips [i];

                    gr.MeasureString (tip, 1.0 - x, true, out width, out height);

                    if (y + height > 0.98)
                        break;

                    gr.DrawStringWithWrapping (x, y, tip , 1.0 - x);
                    y += height + space_small;
                }

                if (caching)
                    cached_sessionid = session.ID;
            }
            else  {
                gr.ShowPangoText (Translations.GetString ("Congratulations! New personal record"), false, -1, 0);
                DrawBand (gr, 0.03, y - 0.01);

                y += 0.08;

                for (int i = 0; i < records.Count; i++)
                {
                    switch (records[i].GameType) {
                    case GameTypes.LogicPuzzle:
                        s = String.Format (Translations.
                            GetString ("By scoring {0} in logic puzzle games you have established a new personal record. Your previous record was {1}."),
                            records[i].NewScore,
                            records[i].PreviousScore);
                        break;
                    case GameTypes.Calculation:
                        s = String.Format (Translations.
                            GetString ("By scoring {0} in calculation games you have established a new personal record. Your previous record was {1}."),
                            records[i].NewScore,
//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:gbrainy,代码行数:101,代码来源:FinishView.cs

示例5: DrawColumnBarGraphic

        void DrawColumnBarGraphic(CairoContextEx gr, double x, double y)
        {
            const double area_w = 0.85, area_h = 0.28;
            const double bar_w = 0.05, bar_h = area_h - 0.02;
            const double space_x = 0.08;

            gr.LineWidth = 0.005;

            // Draw X reference values
            gr.SetPangoFontSize (smaller_font);
            gr.DrawTextAlignedRight (x + 0.05, y, "100");
            gr.DrawTextAlignedRight (x + 0.05, y + area_h - 0.02, "0");

            x += 0.06;

            // Axis
            gr.MoveTo (x, y);
            gr.LineTo (x, y + area_h);
            gr.LineTo (x + area_w, y + area_h);
            gr.Stroke ();

            x = x + space_x;
            DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.TotalScore);
            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Total"));

            x = x + space_x * 2;

            if (session.History.LogicPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.LogicScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Logic"));

            x = x + space_x * 2;

            if (session.History.MathPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.MathScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Calculation"));

            x = x + space_x * 2;

            if (session.History.MemoryPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.MemoryScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Memory"));

            x = x + space_x * 2;

            if (session.History.VerbalPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.VerbalScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Verbal"));
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:53,代码来源:FinishView.cs

示例6: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            int element;
            double x = DrawAreaX;
            double y = 0.05, pos_y;

            base.Draw (gr, area_width, area_height, rtl);

            for (int i = 0; i < (Answer.Draw ? question_columns : question_columns - 1); i++)
            {
                element = question_indices [i];
                pos_y = y;
                for (int n = 0; n < figures_column; n++)
                {
                    DrawFigure (gr, x, pos_y, figures [(n * question_columns) + element]);
                    pos_y+= figure_size + space_height;
                }
                x+= figure_size + space_width;
            }

            if (Answer.Draw == false) {
                gr.Save ();
                gr.SetPangoFontSize (figure_size);
                for (int n = 0; n < figures_column; n++) {
                    gr.MoveTo (x, y - 0.02);
                    gr.ShowPangoText ("?");
                    gr.Stroke ();
                    y+= figure_size + space_height;
                }
                gr.SetPangoNormalFontSize ();
                gr.Restore ();
            }

            gr.MoveTo (0.08, 0.45);
            gr.ShowPangoText (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Choose one of the following:"));
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:37,代码来源:PuzzleFigures.cs

示例7: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = 0.05, y = DrawAreaY + 0.1;

            base.Draw (gr, area_width, area_height, rtl);

            DrawBalance (gr, x, y, group * elements * 6, true);
            y += 0.3;

            DrawBalance (gr, x, y, (group * elements * 6) + 1 * elements * 2, true);
            y += 0.3;

            DrawBalance (gr, x, y, (group * elements * 6) + 2 * elements * 2, false);

            gr.SetPangoFontSize (0.05);
            gr.MoveTo (0.74, 0.68);
            gr.ShowPangoText ("?");
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:19,代码来源:PuzzleBalance.cs

示例8: DrawQuestionAndAnswer

        void DrawQuestionAndAnswer(CairoContextEx cr, int height)
        {
            double max_width;
            double line_space;

            line_space = cr.FontLineSpace;
            cr.FontLineSpace = 0;
            cr.SetPangoFontSize (0.020);

            max_width = 1 - (text_margin * 2);
            cr.UseMarkup = true;

            DrawQuestion (cr, height, max_width);
            DrawSolution (cr, height, max_width);

            cr.UseMarkup = false;
            cr.FontLineSpace = line_space;
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:18,代码来源:GameDrawingArea.cs

示例9: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            if (!IsRealized)
                return false;

            int w, h, total_w, total_h;

            Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
            CairoContextEx cr = new CairoContextEx (cc.Handle, this);

            args.Window.GetSize (out total_w, out total_h);

            h = total_h - question_high;
            if (UseSolutionArea)
                h -= solution_high;

            w = total_w;

            // We want a square drawing area for the puzzles then the figures are shown as designed.
            // For example, squares are squares. This also makes sure that proportions are kept when resizing
            DrawingSquare = Math.Min (w, h);

            if (DrawingSquare < w)
                OffsetX = (w - DrawingSquare) / 2d;
            else
                OffsetX = 0;

            if (DrawingSquare < h)
                OffsetY = (h - DrawingSquare) / 2d;
            else
                OffsetY = 0;

            OffsetY += question_high;

            // Draw a background taking all the window area
            cr.Save ();
            cr.Scale (total_w, total_h);
            cr.DrawBackground ();

            if (Paused == false) {
                DrawQuestionAndAnswer (cr, total_h);
            } else {
                cr.SetPangoFontSize (0.08);
                cr.DrawTextCentered (0.5, 0.5, Catalog.GetString ("Paused"));
                cr.Stroke ();
            }
            cr.Restore ();

            if (Paused == false) {
                // Draw the game area
                cr.Translate (OffsetX, OffsetY);
                cr.SetPangoNormalFontSize ();
                cr.Color = new Color (1, 1, 1, 0.5);
                Drawable.Draw (cr, DrawingSquare, DrawingSquare, Direction == Gtk.TextDirection.Rtl);
                cr.Stroke ();
            }

            ((IDisposable)cc).Dispose();
            ((IDisposable)cr).Dispose();
            return true;
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:61,代码来源:GameDrawingArea.cs

示例10: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double org_x = DrawAreaX + 0.1;
            double x = org_x, y = 0.08;
            double x45, y45, x135, y135, offset;

            base.Draw (gr, area_width, area_height, rtl);

            // First pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawCross (gr, x, y, figure_size);

            y += space_y;
            x = org_x;
            // Second pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawRotatedCross (gr, x, y, figure_size);

            // Rotated rectangle
            x += figure_size + space_x;
            x45 = figure_size * Math.Cos (45 * Math.PI / 180);
            y45 = figure_size * Math.Sin (45 * Math.PI / 180);
            x135 = figure_size * Math.Cos (135 * Math.PI / 180);
            y135 = figure_size * Math.Sin (135 * Math.PI / 180);
            offset = - 0.03;
            // Down-right
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x45, y + offset + y45);
            // Up right
            gr.LineTo ((x + figure_size / 2 + x45) + x135, (y + offset +  y45) + y135);
            gr.Stroke ();
            // Down left
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x135, y + offset + y135);
            // Up left
            gr.LineTo (x + figure_size / 2 + x135 + x45, y + offset + y135 + y45);
            gr.Stroke ();

            y += space_y;
            x = org_x;

            // Third pattern
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.LineTo (x + figure_size, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.LineTo (x, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + 0.03, y - 0.02);
            gr.SetPangoFontSize (figure_size);
            gr.ShowPangoText ("?");
            gr.SetPangoNormalFontSize ();
            gr.Stroke ();

            gr.MoveTo (0.05, y - 0.01 + space_y);
            gr.ShowPangoText (Translations.GetString ("Choose one of the following:"));
            gr.Stroke ();
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:92,代码来源:PuzzleFigurePattern.cs

示例11: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double org_x = DrawAreaX + 0.1;
            double x = org_x, y = 0.08;
            const double figure_size = 0.13, space_x = 0.1, space_y = 0.18;
            double x45, y45, x135, y135, offset;

            base.Draw (gr, area_width, area_height, rtl);

            // First pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x + figure_size / 2, y);
            gr.LineTo (x + figure_size / 2, y + figure_size);
            gr.MoveTo (x, y + figure_size / 2);
            gr.LineTo (x + figure_size, y + figure_size / 2);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawCross (gr, x, y, figure_size);

            y += space_y;
            x = org_x;
            // Second pattern
            gr.Rectangle (x, y, figure_size, figure_size);
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            DrawRotatedCross (gr, x, y, figure_size);

            // Rotated rectangle
            x += figure_size + space_x;
            x45 = figure_size * Math.Cos (45 * Math.PI / 180);
            y45 = figure_size * Math.Sin (45 * Math.PI / 180);
            x135 = figure_size * Math.Cos (135 * Math.PI / 180);
            y135 = figure_size * Math.Sin (135 * Math.PI / 180);
            offset = - 0.03;
            // Down-right
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x45, y + offset + y45);
            // Up right
            gr.LineTo ((x + figure_size / 2 + x45) + x135, (y + offset +  y45) + y135);
            gr.Stroke ();
            // Down left
            gr.MoveTo (x + figure_size / 2, y + offset);
            gr.LineTo (x + figure_size / 2 + x135, y + offset + y135);
            // Up left
            gr.LineTo (x + figure_size / 2 + x135 + x45, y + offset + y135 + y45);
            gr.Stroke ();

            y += space_y;
            x = org_x;

            // Third pattern
            gr.MoveTo (x, y);
            gr.LineTo (x + figure_size, y);
            gr.LineTo (x, y + figure_size);
            gr.LineTo (x + figure_size, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + figure_size, y);
            gr.LineTo (x, y);
            gr.LineTo (x + figure_size, y + figure_size);
            gr.LineTo (x, y  + figure_size);
            gr.Stroke ();

            x += figure_size + space_x;
            gr.MoveTo (x + 0.03, y - 0.02);
            gr.SetPangoFontSize (figure_size);
            gr.ShowPangoText ("?");
            gr.SetPangoNormalFontSize ();
            gr.Stroke ();

            gr.MoveTo (0.05, y - 0.01 + space_y);
            gr.ShowPangoText (Translations.GetString ("Choose one of the following:"));

            // Answers
            x = org_x;
            y += space_y + 0.07;

            for (int i = 0; i < (int) Figures.Last; i++)
            {
             	switch ((Figures) random_indices[i]) {
                case Figures.TwoLines:
//.........这里部分代码省略.........
开发者ID:dineshkummarc,项目名称:gbrainy,代码行数:101,代码来源:PuzzleFigurePattern.cs


注:本文中的gbrainy.Core.Main.CairoContextEx.SetPangoFontSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。