Commit 8bed5053 authored by faa's avatar faa
Browse files

cyrillic font support, russian GOST support

parent 76467a7f
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,11 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# building minizip.
# building minizip.
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)


# Russian GOST and CYRILLIC patch
option(KICAD_CYRILLIC "enable/disable building unicode (default OFF)")
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building unicode (default OFF)")

# Comment this out if you don't want to build with Python support.
# Comment this out if you don't want to build with Python support.
# OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")
# OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")


@@ -33,6 +38,18 @@ if(CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
    set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
endif(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX)


if(KICAD_CYRILLIC)
    add_definitions(-DKICAD_CYRILLIC)
endif(KICAD_CYRILLIC)

if(wxUSE_UNICODE)
    add_definitions(-DwxUSE_UNICODE)
endif(wxUSE_UNICODE)

if(KICAD_GOST)
    add_definitions(-DKICAD_GOST)
endif(KICAD_GOST)

# Locations for install targets.
# Locations for install targets.
set(KICAD_BIN bin
set(KICAD_BIN bin
    CACHE PATH "Location of KiCad binaries.")
    CACHE PATH "Location of KiCad binaries.")
+5 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2008-nov-5 UPDATE Andrey Fedorushkov <andrf@mail.ru>
================================================================================
+all:
   Add cyrillic font support.
   Add russian GOST worksheet support.


2008-nov-2 CLEANUP Jerry Jacobs <jerkejacobs@gmail.com>
2008-nov-2 CLEANUP Jerry Jacobs <jerkejacobs@gmail.com>
================================================================================
================================================================================
+9 −1
Original line number Original line Diff line number Diff line
@@ -535,7 +535,15 @@ void EDA_TextStruct::CreateDrawData()
    while( kk++ < nbchar )
    while( kk++ < nbchar )
    {
    {
        x0 = 0; y0 = 0;
        x0 = 0; y0 = 0;
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
	AsciiCode = (*ptr) & 0x7FF;
	if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr
	    AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF;
	else
	    AsciiCode = AsciiCode & 0xFF;
#else
         AsciiCode = (*ptr) & 255;
         AsciiCode = (*ptr) & 255;
#endif
        ptcar = graphic_fonte_shape[AsciiCode];  /* ptcar pointe la description
        ptcar = graphic_fonte_shape[AsciiCode];  /* ptcar pointe la description
                                                  *  du caractere a dessiner */
                                                  *  du caractere a dessiner */


+8 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,14 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxS
    m_Name   = name;
    m_Name   = name;


    // Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
    // Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
#if defined(KICAD_GOST)
    m_LeftMargin = LEFTMARGIN;
    m_RightMargin = RIGHTMARGIN;
    m_TopMargin = TOPMARGIN;
    m_BottomMargin = BOTTOMMARGIN;
#else
     m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
     m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
#endif
}
}




+147 −0
Original line number Original line Diff line number Diff line
@@ -127,6 +127,17 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
    xg    = (PageSize.x - Sheet->m_RightMargin) * conv_unit;
    xg    = (PageSize.x - Sheet->m_RightMargin) * conv_unit;
    yg    = (PageSize.y - Sheet->m_BottomMargin) * conv_unit;   /* lower right corner */
    yg    = (PageSize.y - Sheet->m_BottomMargin) * conv_unit;   /* lower right corner */


#if defined(KICAD_GOST)
    FctPlume(ref,'U');
    pos.x = xg; pos.y = ref.y;
    FctPlume(pos,'D');
    pos.x = xg; pos.y = yg;
    FctPlume(pos,'D');
    pos.x = ref.x; pos.y = yg;
    FctPlume( pos,'D' );
    FctPlume(ref,'D');
#else

    for( ii = 0; ii < 2; ii++ )
    for( ii = 0; ii < 2; ii++ )
    {
    {
        FctPlume( ref, 'U' );
        FctPlume( ref, 'U' );
@@ -140,6 +151,7 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
        ref.x += GRID_REF_W * conv_unit; ref.y += GRID_REF_W * conv_unit;
        ref.x += GRID_REF_W * conv_unit; ref.y += GRID_REF_W * conv_unit;
        xg -= GRID_REF_W * conv_unit; yg -= GRID_REF_W * conv_unit;
        xg -= GRID_REF_W * conv_unit; yg -= GRID_REF_W * conv_unit;
    }
    }
#endif


    /* trace des reperes */
    /* trace des reperes */
    text_size.x = WSTEXTSIZE * conv_unit;
    text_size.x = WSTEXTSIZE * conv_unit;
@@ -150,6 +162,48 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
    xg    = (PageSize.x - Sheet->m_RightMargin);
    xg    = (PageSize.x - Sheet->m_RightMargin);
    yg    = (PageSize.y - Sheet->m_BottomMargin);   /* lower right corner in 1/1000 inch */
    yg    = (PageSize.y - Sheet->m_BottomMargin);   /* lower right corner in 1/1000 inch */


#if defined(KICAD_GOST)
    for ( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
    {
	pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
	pos.y = (yg - WsItem->m_Posy) * conv_unit;
	msg.Empty();
	switch( WsItem->m_Type )
	{
	    case WS_CADRE:
		break;
	    case WS_PODPIS_LU:
		if(WsItem->m_Legende) msg = WsItem->m_Legende;
		PlotGraphicText(format_plot, pos, color,
				msg, TEXT_ORIENT_VERT, text_size,
                        	GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);

        	break;
    	    case WS_SEGMENT_LU:
    		FctPlume(pos, 'U');
    		pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
    		pos.y = (yg - WsItem->m_Endy) * conv_unit;
		FctPlume(pos, 'D');
    		break;
	}
    }
    for ( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
    {
	pos.x = (ref.x + WsItem->m_Posx) * conv_unit;
	pos.y = (ref.y + WsItem->m_Posy) * conv_unit;
	msg.Empty();
	switch( WsItem->m_Type )
	{
    	    case WS_SEGMENT_LT:
    		FctPlume(pos, 'U');
        	pos.x = (ref.x + WsItem->m_Endx) * conv_unit;
        	pos.y = (ref.y + WsItem->m_Endy) * conv_unit;
        	FctPlume(pos, 'D');
        	break;
	}
    }
#else

    /* Trace des reperes selon l'axe X */
    /* Trace des reperes selon l'axe X */
    ipas  = (xg - ref.x) / PAS_REF;
    ipas  = (xg - ref.x) / PAS_REF;
    gxpas = ( xg - ref.x) / ipas;
    gxpas = ( xg - ref.x) / ipas;
@@ -214,10 +268,102 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
        PlotGraphicText( format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
        PlotGraphicText( format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size,
            GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
            GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER );
    }
    }
#endif


    /* Trace du cartouche */
    /* Trace du cartouche */
    text_size.x = SIZETEXT * conv_unit;
    text_size.x = SIZETEXT * conv_unit;
    text_size.y = SIZETEXT * conv_unit;
    text_size.y = SIZETEXT * conv_unit;
#if defined(KICAD_GOST)
    ref.x = PageSize.x - Sheet->m_RightMargin;
    ref.y = PageSize.y - Sheet->m_BottomMargin;
    if (screen->m_ScreenNumber == 1)
    {
	for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
	{
	    pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
	    pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
	    msg.Empty();
	    switch( WsItem->m_Type )
	    {
		case WS_DATE:
		    break;
		case WS_REV:
		    break;
		case WS_KICAD_VERSION:
		    break;
		case WS_PODPIS:
		    if(WsItem->m_Legende) msg = WsItem->m_Legende;
		    PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
				    GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
		    break;
		case WS_SIZESHEET:
		    break;
		case WS_IDENTSHEET:
		    if(WsItem->m_Legende) msg = WsItem->m_Legende;
		    msg << screen->m_ScreenNumber;
		    PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
				    GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
		    break;
		case WS_SHEETS:
		    if(WsItem->m_Legende) msg = WsItem->m_Legende;
		    msg << screen->m_NumberOfScreen;
		    PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
				    GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
		    break;
		case WS_COMPANY_NAME:
		    break;
		case WS_TITLE:
		    break;
		case WS_COMMENT1:
		    break;
		case WS_COMMENT2:
		    break;
		case WS_COMMENT3:
		    break;
		case WS_COMMENT4:
		    break;
		case WS_UPPER_SEGMENT:
		case WS_LEFT_SEGMENT:
		case WS_SEGMENT:
		    FctPlume(pos, 'U');
		    pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
		    pos.y = (ref.y - WsItem->m_Endy)  * conv_unit;
		    FctPlume(pos, 'D');
		    break;
	    }
	}
    } else {
	for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext )
	{
	    pos.x = (ref.x - WsItem->m_Posx) * conv_unit;
	    pos.y = (ref.y - WsItem->m_Posy) * conv_unit;
	    msg.Empty();
	    switch( WsItem->m_Type )
	    {
		case WS_CADRE:
		/* Begin list number > 1 */
		case WS_PODPIS_D:
		    if(WsItem->m_Legende) msg = WsItem->m_Legende;
		    PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
				    GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
		    break;
		case WS_IDENTSHEET_D:
		    if(WsItem->m_Legende) msg = WsItem->m_Legende;
		    msg << screen->m_ScreenNumber;
		    PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size,
				    GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
		    break;
		case WS_LEFT_SEGMENT_D:
		case WS_SEGMENT_D:
		    FctPlume(pos, 'U');
		    pos.x = (ref.x - WsItem->m_Endx) * conv_unit;
		    pos.y = (ref.y - WsItem->m_Endy) * conv_unit;
		    FctPlume(pos, 'D');
		    break;
	    }
	}
    }
#else
    ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
    ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
    ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
    ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;


@@ -327,6 +473,7 @@ void PlotWorkSheet( int format_plot, BASE_SCREEN* screen )
                GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
                GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
        }
        }
    }
    }
#endif


    switch( format_plot )
    switch( format_plot )
    {
    {
Loading